diff -Nrub clearsilver-0.10.1/aclocal.m4 clearsilver-0.10.2/aclocal.m4
--- clearsilver-0.10.1/aclocal.m4	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/aclocal.m4	2005-12-14 16:26:05.000000000 -0800
@@ -0,0 +1,111 @@
+# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
+
+# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+dnl @synopsis AC_JNI_INCLUDE_DIR
+dnl
+dnl AC_JNI_INCLUDE_DIR finds include directories needed
+dnl for compiling programs using the JNI interface.
+dnl
+dnl JNI include directories are usually in the java distribution
+dnl This is deduced from the value of JAVAC.  When this macro
+dnl completes, a list of directories is left in the variable
+dnl JNI_INCLUDE_DIRS.
+dnl
+dnl Example usage follows:
+dnl
+dnl     AC_JNI_INCLUDE_DIR
+dnl
+dnl     for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+dnl     do
+dnl             CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
+dnl     done
+dnl
+dnl If you want to force a specific compiler:
+dnl
+dnl - at the configure.in level, set JAVAC=yourcompiler before calling
+dnl AC_JNI_INCLUDE_DIR
+dnl
+dnl - at the configure level, setenv JAVAC
+dnl
+dnl Note: This macro can work with the autoconf M4 macros for Java programs.
+dnl This particular macro is not part of the original set of macros.
+dnl
+dnl @author Don Anderson <dda@sleepycat.com>
+dnl @version $Id: ac_jni_include_dirs.m4,v 1.3 2004/12/24 01:16:37 guidod Exp $
+dnl
+AC_DEFUN([AC_JNI_INCLUDE_DIR],[
+
+JNI_INCLUDE_DIRS=""
+
+test "x$JAVAC" = x && AC_MSG_ERROR(['$JAVAC' undefined])
+AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no)
+test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path])
+
+_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
+_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
+case "$host_os" in
+        darwin*)        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+                        _JINC="$_JTOPDIR/Headers";;
+        *)              _JINC="$_JTOPDIR/include";;
+esac
+if test -f "$_JINC/jni.h"; then
+        JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
+else
+        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+        if test -f "$_JTOPDIR/include/jni.h"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
+        else
+                AC_MSG_ERROR([cannot find java include files])
+        fi
+fi
+
+# get the likely subdirectories for system specific java includes
+case "$host_os" in
+bsdi*)          _JNI_INC_SUBDIRS="bsdos";;
+linux*)         _JNI_INC_SUBDIRS="linux genunix";;
+osf*)           _JNI_INC_SUBDIRS="alpha";;
+solaris*)       _JNI_INC_SUBDIRS="solaris";;
+mingw*)			_JNI_INC_SUBDIRS="win32";;
+cygwin*)		_JNI_INC_SUBDIRS="win32";;
+*)              _JNI_INC_SUBDIRS="genunix";;
+esac
+
+# add any subdirectories that are present
+for JINCSUBDIR in $_JNI_INC_SUBDIRS
+do
+        if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
+        fi
+done
+])
+
+# _ACJNI_FOLLOW_SYMLINKS <path>
+# Follows symbolic links on <path>,
+# finally setting variable _ACJNI_FOLLOWED
+# --------------------
+AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[
+# find the include directory relative to the javac executable
+_cur="$1"
+while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
+        AC_MSG_CHECKING(symlink for $_cur)
+        _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
+        case "$_slink" in
+        /*) _cur="$_slink";;
+        # 'X' avoids triggering unwanted echo options.
+        *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";;
+        esac
+        AC_MSG_RESULT($_cur)
+done
+_ACJNI_FOLLOWED="$_cur"
+])# _ACJNI
+
diff -Nrub clearsilver-0.10.1/autogen.sh clearsilver-0.10.2/autogen.sh
--- clearsilver-0.10.1/autogen.sh	2005-06-30 11:51:48.000000000 -0700
+++ clearsilver-0.10.2/autogen.sh	2005-11-16 19:54:43.000000000 -0800
@@ -5,7 +5,7 @@
 test -z "$srcdir" && srcdir=.
 
 
-# aclocal -I /usr/share/glade/gnome
+aclocal -I m4
 autoheader
 autoconf
 ./configure $*
diff -Nrub clearsilver-0.10.1/cgi/cgi.c clearsilver-0.10.2/cgi/cgi.c
--- clearsilver-0.10.1/cgi/cgi.c	2005-06-30 18:14:36.000000000 -0700
+++ clearsilver-0.10.2/cgi/cgi.c	2005-12-02 01:34:04.000000000 -0800
@@ -234,11 +234,12 @@
   return STATUS_OK;
 }
 
-unsigned char *cgi_url_unescape (unsigned char *s)
+char *cgi_url_unescape (char *value)
 {
   int i = 0, o = 0;
+  unsigned char *s = (unsigned char *)value;
 
-  if (s == NULL) return s;
+  if (s == NULL) return value;
   while (s[i])
   {
     if (s[i] == '+')
@@ -260,13 +261,14 @@
     }
   }
   if (i && o) s[o] = '\0';
-  return s;
+  return (char *)s;
 }
 
-NEOERR *cgi_js_escape (const unsigned char *buf, unsigned char **esc)
+NEOERR *cgi_js_escape (const char *in, char **esc)
 {
   int nl = 0;
   int l = 0;
+  unsigned char *buf = (unsigned char *)in;
   unsigned char *s;
 
   while (buf[l])
@@ -280,7 +282,7 @@
     l++;
   }
 
-  s = (char *) malloc (sizeof(char) * (nl + 1));
+  s = (unsigned char *) malloc (sizeof(unsigned char) * (nl + 1));
   if (s == NULL) 
     return nerr_raise (NERR_NOMEM, "Unable to allocate memory to escape %s", 
 	buf);
@@ -304,34 +306,55 @@
   }
   s[nl] = '\0';
 
-  *esc = s;
+  *esc = (char *)s;
   return STATUS_OK;
 }
 
-NEOERR *cgi_url_escape_more (const unsigned char *buf, unsigned char **esc, 
-                             const unsigned char *other)
+// List of all characters that must be escaped
+// List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
+static char EscapedChars[] = "$&+,/:;=?@ \"<>#%{}|\\^~[]`";
+
+// Check if a single character needs to be escaped
+static BOOL is_reserved_char(char c)
+{
+  int i = 0;
+
+  if (c < 32 || c > 122) {
+    return TRUE;
+  } else {
+    while (EscapedChars[i]) {
+      if (c == EscapedChars[i]) {
+        return TRUE;
+      }
+      ++i;
+    }
+  }
+  return FALSE;
+}
+
+NEOERR *cgi_url_escape_more (const char *in, char **esc,
+                             const char *other)
 {
   int nl = 0;
   int l = 0;
   int x = 0;
+  unsigned char *buf = (unsigned char *)in;
+  unsigned char *uother = (unsigned char *)other;
   unsigned char *s;
   int match = 0;
 
   while (buf[l])
   {
-    if (buf[l] == '/' || buf[l] == '+' || buf[l] == '=' || buf[l] == '&' || 
-	buf[l] == '"' || buf[l] == '%' || buf[l] == '?' || buf[l] == '#' ||
-	buf[l] == '<' || buf[l] == '>' || buf[l] == '\'' ||
-        buf[l] < 32 || buf[l] > 122)
+    if (is_reserved_char(buf[l]))
     {
       nl += 2;
     } 
-    else if (other)
+    else if (uother)
     {
       x = 0;
-      while (other[x])
+      while (uother[x])
       {
-	if (other[x] == buf[l])
+	if (uother[x] == buf[l])
 	{
 	  nl +=2;
 	  break;
@@ -359,19 +382,16 @@
     }
     else
     {
-      if (buf[l] == '/' || buf[l] == '+' || buf[l] == '=' || buf[l] == '&' || 
-	  buf[l] == '"' || buf[l] == '%' || buf[l] == '?' || buf[l] == '#' ||
-	  buf[l] == '<' || buf[l] == '>' || buf[l] == '\'' ||
-          buf[l] < 32 || buf[l] > 122)
+      if (is_reserved_char(buf[l]))
       {
 	match = 1;
       }
-      else if (other)
+      else if (uother)
       {
 	x = 0;
-	while (other[x])
+	while (uother[x])
 	{
-	  if (other[x] == buf[l])
+	  if (uother[x] == buf[l])
 	  {
 	    match = 1;
 	    break;
@@ -394,11 +414,11 @@
   }
   s[nl] = '\0';
 
-  *esc = s;
+  *esc = (char *)s;
   return STATUS_OK;
 }
 
-NEOERR *cgi_url_escape (const unsigned char *buf, unsigned char **esc)
+NEOERR *cgi_url_escape (const char *buf, char **esc)
 {
   return nerr_pass(cgi_url_escape_more(buf, esc, NULL));
 }
@@ -999,7 +1019,7 @@
 
   stream.next_in = (Bytef*)str->buf;
   stream.avail_in = (uInt)str->len;
-  stream.next_out = obuf;
+  stream.next_out = (Bytef*)obuf;
   stream.avail_out = (uInt)*olen;
   if ((uLong)stream.avail_out != *olen) 
     return nerr_raise(NERR_NOMEM, "Destination too big: %ld", *olen);
@@ -1057,7 +1077,7 @@
   int ws = 0;
   int seen_nonws = level > 1;
   int i, o, l;
-  unsigned char *ch;
+  char *ch;
 
   i = o = 0;
   if (str->len) {
@@ -1309,7 +1329,7 @@
       if (use_gzip)
       {
 	crc = crc32(0L, Z_NULL, 0);
-	crc = crc32(crc, str->buf, str->len);
+	crc = crc32(crc, (const Bytef *)(str->buf), str->len);
       }
       len2 = str->len * 2;
       dest = (char *) malloc (sizeof(char) * len2);
@@ -1372,17 +1392,17 @@
   return nerr_pass(err);
 }
 
-NEOERR *cgi_html_escape_strfunc(const unsigned char *str, unsigned char **ret)
+NEOERR *cgi_html_escape_strfunc(const char *str, char **ret)
 {
   return nerr_pass(html_escape_alloc(str, strlen(str), ret));
 }
 
-NEOERR *cgi_html_strip_strfunc(const unsigned char *str, unsigned char **ret)
+NEOERR *cgi_html_strip_strfunc(const char *str, char **ret)
 {
   return nerr_pass(html_strip_alloc(str, strlen(str), ret));
 }
 
-NEOERR *cgi_text_html_strfunc(const unsigned char *str, unsigned char **ret)
+NEOERR *cgi_text_html_strfunc(const char *str, char **ret)
 {
   return nerr_pass(convert_text_html_alloc(str, strlen(str), ret));
 }
diff -Nrub clearsilver-0.10.1/cgi/cgi.h clearsilver-0.10.2/cgi/cgi.h
--- clearsilver-0.10.1/cgi/cgi.h	2005-06-30 18:11:42.000000000 -0700
+++ clearsilver-0.10.2/cgi/cgi.h	2005-11-30 19:57:32.000000000 -0800
@@ -311,7 +311,7 @@
  * Output: esc - a newly allocated string 
  * Return: NERR_NOMEM - no memory available to allocate the escaped string
  */
-NEOERR *cgi_url_escape (const unsigned char *buf, unsigned char **esc);
+NEOERR *cgi_url_escape (const char *buf, char **esc);
 
 /*
  * Function: cgi_url_escape_more - url escape a string
@@ -325,8 +325,7 @@
  * Output: esc - a newly allocated string 
  * Return: NERR_NOMEM - no memory available to allocate the escaped string
  */
-NEOERR *cgi_url_escape_more (const unsigned char *buf, unsigned char **esc, 
-                             const unsigned char *other);
+NEOERR *cgi_url_escape_more (const char *buf, char **esc, const char *other);
 
 /*
  * Function: cgi_url_unescape - unescape an url encoded string
@@ -337,7 +336,7 @@
  * Input: buf - a 0 terminated string
  * Return: pointer to same buf
  */
-unsigned char *cgi_url_unescape (unsigned char *buf);
+char *cgi_url_unescape (char *buf);
 
 /*
  * Function: cgi_redirect - send an HTTP 302 redirect response
@@ -452,10 +451,10 @@
                           const char *path);
 
 /* not documented *yet* */
-NEOERR *cgi_text_html_strfunc(const unsigned char *str, unsigned char **ret);
-NEOERR *cgi_html_strip_strfunc(const unsigned char *str, unsigned char **ret);
-NEOERR *cgi_html_escape_strfunc(const unsigned char *str, unsigned char **ret);
-NEOERR *cgi_js_escape (const unsigned char *buf, unsigned char **esc);
+NEOERR *cgi_text_html_strfunc(const char *str, char **ret);
+NEOERR *cgi_html_strip_strfunc(const char *str, char **ret);
+NEOERR *cgi_html_escape_strfunc(const char *str, char **ret);
+NEOERR *cgi_js_escape (const char *buf, char **esc);
 void cgi_html_ws_strip(STRING *str, int level);
 NEOERR *cgi_register_strfuncs(CSPARSE *cs);
 
diff -Nrub clearsilver-0.10.1/cgi/html.c clearsilver-0.10.2/cgi/html.c
--- clearsilver-0.10.1/cgi/html.c	2005-06-30 18:18:13.000000000 -0700
+++ clearsilver-0.10.2/cgi/html.c	2005-11-30 20:03:09.000000000 -0800
@@ -22,7 +22,7 @@
 #include "html.h"
 #include "cgi.h"
 
-static int has_space_formatting(const unsigned char *src, int slen)
+static int has_space_formatting(const char *src, int slen)
 {
   int spaces = 0;
   int returns = 0;
@@ -100,7 +100,7 @@
 static char *EmailRe = "[^][@:;<>\\\"()[:space:][:cntrl:]]+@[-+a-zA-Z0-9]+\\.[-+a-zA-Z0-9\\.]+[-+a-zA-Z0-9]";
 static char *URLRe = "((http|https|ftp|mailto):(//)?[^[:space:]>\"\t]*|www\\.[-a-z0-9\\.]+)[^[:space:];\t\">]*";
 
-static NEOERR *split_and_convert (const unsigned char *src, int slen,
+static NEOERR *split_and_convert (const char *src, int slen,
                                   STRING *out, HTML_CONVERT_OPTS *opts)
 {
   NEOERR *err = STATUS_OK;
@@ -108,7 +108,8 @@
   static regex_t email_re, url_re;
   regmatch_t email_match, url_match;
   int errcode;
-  unsigned char buf[256], *ptr, *esc;
+  char *ptr, *esc;
+  char errbuf[256];
   struct _parts *parts;
   int part_count;
   int part;
@@ -119,13 +120,13 @@
   {
     if ((errcode = regcomp (&email_re, EmailRe, REG_ICASE | REG_EXTENDED)))
     {
-      regerror (errcode, &email_re, buf, sizeof(buf));
-      return nerr_raise (NERR_PARSE, "Unable to compile EmailRE: %s", buf);
+      regerror (errcode, &email_re, errbuf, sizeof(errbuf));
+      return nerr_raise (NERR_PARSE, "Unable to compile EmailRE: %s", errbuf);
     }
     if ((errcode = regcomp (&url_re, URLRe, REG_ICASE | REG_EXTENDED)))
     {
-      regerror (errcode, &url_re, buf, sizeof(buf));
-      return nerr_raise (NERR_PARSE, "Unable to compile URLRe: %s", buf);
+      regerror (errcode, &url_re, errbuf, sizeof(errbuf));
+      return nerr_raise (NERR_PARSE, "Unable to compile URLRe: %s", errbuf);
     }
     compiled = 1;
   }
@@ -360,7 +361,7 @@
       spaces = 0;
       if (parts[i].type == SC_TYPE_URL)
       {
-        unsigned char last_char = src[parts[i].end-1];
+        char last_char = src[parts[i].end-1];
         int suffix=0;
         if (last_char == '.' || last_char == ',') { suffix=1; }
 	err = string_append (out, " <a ");
@@ -379,7 +380,7 @@
 	if (err) break;
 	if (opts->bounce_url)
 	{
-	  unsigned char *url, *esc_url, *new_url;
+	  char *url, *esc_url, *new_url;
 	  int url_len;
 	  if (!strncasecmp(src + x, "www.", 4))
 	  {
@@ -438,10 +439,10 @@
 	err = string_append (out, "\">");
 	if (err != STATUS_OK) break;
         if (opts->link_name) {
-          err = html_escape_alloc(opts->link_name, strlen(opts->link_name), 
-              &esc);
+          err = html_escape_alloc((opts->link_name),
+                                  strlen(opts->link_name), &esc);
         } else {
-          err = html_escape_alloc(src + x, parts[i].end - x - suffix, &esc);
+          err = html_escape_alloc((src + x), parts[i].end - x - suffix, &esc);
         }
 	if (err != STATUS_OK) break;
 	err = string_append (out, esc);
@@ -488,7 +489,7 @@
 {
   int x = 0;
   int ol = str->len;
-  unsigned char *ptr;
+  char *ptr;
   int i;
 
   while (x < str->len)
@@ -508,7 +509,7 @@
     }
     else
     {
-      x = i = ptr - (unsigned char *) str->buf;
+      x = i = ptr - str->buf;
       if (x)
       {
 	x--;
@@ -524,14 +525,14 @@
   }
 }
 
-NEOERR *convert_text_html_alloc (const unsigned char *src, int slen,
-                                 unsigned char **out)
+NEOERR *convert_text_html_alloc (const char *src, int slen,
+                                 char **out)
 {
     return nerr_pass(convert_text_html_alloc_options(src, slen, out, NULL));
 }
 
-NEOERR *convert_text_html_alloc_options (const unsigned char *src, int slen,
-                                         unsigned char **out,
+NEOERR *convert_text_html_alloc_options (const char *src, int slen,
+                                         char **out,
                                          HTML_CONVERT_OPTS *opts)
 {
   NEOERR *err;
@@ -598,13 +599,13 @@
   return STATUS_OK;
 }
 
-NEOERR *html_escape_alloc (const unsigned char *src, int slen,
-                           unsigned char **out)
+NEOERR *html_escape_alloc (const char *src, int slen,
+                           char **out)
 {
   NEOERR *err = STATUS_OK;
   STRING out_s;
   int x;
-  unsigned char *ptr;
+  char *ptr;
 
   string_init(&out_s);
   err = string_append (&out_s, "");
@@ -649,15 +650,15 @@
 }
 
 /* Replace ampersand with iso-8859-1 character code */
-static unsigned char _expand_amp_8859_1_char (const unsigned char *s)
+static unsigned char _expand_amp_8859_1_char (const char *s)
 {
   if (s[0] == '\0')
     return 0;
 
   switch (s[0]) {
     case '#':
-      if (s[1] == 'x') return strtol (&s[2], NULL, 16);
-      return strtol (&s[1], NULL, 10);
+      if (s[1] == 'x') return strtol (s+2, NULL, 16);
+      return strtol (s+1, NULL, 10);
     case 'a':
       if (!strcmp(s, "agrave")) return 0xe0; /* à */
       if (!strcmp(s, "aacute")) return 0xe1; /* á */
@@ -724,8 +725,8 @@
   return 0;
 }
 
-unsigned char *html_expand_amp_8859_1(const unsigned char *amp,
-                                      unsigned char *buf)
+char *html_expand_amp_8859_1(const char *amp,
+                                      char *buf)
 {
   unsigned char ch;
 
@@ -736,23 +737,23 @@
     return "";
   }
   else {
-    buf[0] = ch;
+    buf[0] = (char)ch;
     buf[1] = '\0';
     return buf;
   }
 }
 
-NEOERR *html_strip_alloc(const unsigned char *src, int slen,
-                         unsigned char **out)
+NEOERR *html_strip_alloc(const char *src, int slen,
+                         char **out)
 {
   NEOERR *err = STATUS_OK;
   STRING out_s;
   int x = 0;
   int strip_match = -1;
   int state = 0;
-  unsigned char amp[10];
+  char amp[10];
   int amp_start = 0;
-  unsigned char buf[10];
+  char buf[10];
   int ampl = 0;
 
   string_init(&out_s);
diff -Nrub clearsilver-0.10.1/cgi/html.h clearsilver-0.10.2/cgi/html.h
--- clearsilver-0.10.1/cgi/html.h	2005-06-30 18:16:42.000000000 -0700
+++ clearsilver-0.10.2/cgi/html.h	2005-12-01 17:13:25.000000000 -0800
@@ -19,27 +19,24 @@
 __BEGIN_DECLS
 
 typedef struct _text_html_opts {
-    char *bounce_url;
-    char *url_class;
-    char *url_target;
-    char *mailto_class;
+    const char *bounce_url;
+    const char *url_class;
+    const char *url_target;
+    const char *mailto_class;
     int long_lines;
     int space_convert;
     int newlines_convert;
     int longline_width;
     int check_ascii_art;
-    char *link_name;
+    const char *link_name;
 } HTML_CONVERT_OPTS;
 
-NEOERR *convert_text_html_alloc (const unsigned char *src, int slen,
-                                 unsigned char **out);
-NEOERR *convert_text_html_alloc_options (const unsigned char *src, int slen,
-                                         unsigned char **out, 
+NEOERR *convert_text_html_alloc (const char *src, int slen, char **out);
+NEOERR *convert_text_html_alloc_options (const char *src, int slen,
+                                         char **out, 
                                          HTML_CONVERT_OPTS *opts);
-NEOERR *html_escape_alloc (const unsigned char *src, int slen,
-                           unsigned char **out);
-NEOERR *html_strip_alloc(const unsigned char *src, int slen,
-                         unsigned char **out);
+NEOERR *html_escape_alloc (const char *src, int slen, char **out);
+NEOERR *html_strip_alloc(const char *src, int slen, char **out);
 
 __END_DECLS
 
diff -Nrub clearsilver-0.10.1/cgi/Makefile clearsilver-0.10.2/cgi/Makefile
--- clearsilver-0.10.1/cgi/Makefile	2005-06-30 11:51:48.000000000 -0700
+++ clearsilver-0.10.2/cgi/Makefile	2005-12-02 02:34:24.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 CGI_LIB = $(LIB_DIR)libneo_cgi.a
 CGI_SRC = cgiwrap.c cgi.c html.c date.c rfc2388.c
@@ -32,7 +32,7 @@
 	$(LDSHARED) -o $@ $(STATIC_OBJ) -L$(LIB_DIR) $(DLIBS) $(LIBS)
 
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(cs_includedir)/cgi
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cgi
 	$(INSTALL) -m 644 cgi.h $(DESTDIR)$(cs_includedir)/cgi
 	$(INSTALL) -m 644 cgiwrap.h $(DESTDIR)$(cs_includedir)/cgi
 	$(INSTALL) -m 644 date.h $(DESTDIR)$(cs_includedir)/cgi
diff -Nrub clearsilver-0.10.1/cgi/static.c clearsilver-0.10.2/cgi/static.c
--- clearsilver-0.10.1/cgi/static.c	2005-06-30 11:51:48.000000000 -0700
+++ clearsilver-0.10.2/cgi/static.c	2005-10-18 15:27:59.000000000 -0700
@@ -9,6 +9,11 @@
  *
  */
 
+/* static.cgi
+ * This is a really simple example of how you can map URL requests to a set of
+ * hdf and cs files.
+ */
+
 #include "ClearSilver.h"
 
 #include <unistd.h>
@@ -17,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-int main (int argc, char **argv, char **envp)
+int main(int argc, char **argv, char **envp)
 {
   NEOERR *err;
   CGI *cgi;
@@ -25,28 +30,51 @@
   char hdf_file[_POSIX_PATH_MAX];
   char *p;
 
-  cgi_debug_init (argc,argv);
-  cgiwrap_init_std (argc, argv, envp);
+  /* CGI works by passing information from the server to the CGI program via
+   * environment variables and stdin.  cgi_debug_init looks for a file as the
+   * first argument, and loads it.  That file contains key=value pairs which
+   * cgi_debug_init will load into the environment, allowing you to test your
+   * program via the command line. */
+  cgi_debug_init(argc, argv);
+
+  /* The ClearSilver cgi toolkit accesses the CGI environment through a
+   * wrapper.  This allows the program to be used in other environments and
+   * fake the CGI environment, such as FastCGI, mod_python, PyApache, or even
+   * just from Python to access the python objects instead of the libc API.
+   * cgiwrap_init_std just sets up for the default CGI environment using the
+   * libc api. */
+  cgiwrap_init_std(argc, argv, envp);
 
+  /* cgi_init creates a CGI struct, and parses the CGI environment variables. 
+   * It creates an HDF structure as well.  */
   err = cgi_init(&cgi, NULL);
   if (err != STATUS_OK)
   {
+    /* cgi_neo_error renders a NEOERR as an error CGI result */
     cgi_neo_error(cgi, err);
+    /* nerr_log_error logs the error to stderr and cleans up */
     nerr_log_error(err);
     return -1;
   }
 
-  cs_file = hdf_get_value (cgi->hdf, "CGI.PathTranslated", NULL);
+  /* CGI.PathTranslated is a CGI env var which maps the URL with the
+   * DocumentRoot to give you the location of the referenced file on disk */
+  cs_file = hdf_get_value(cgi->hdf, "CGI.PathTranslated", NULL);
   if (cs_file == NULL)
   {
-    cgi_error (cgi, "No PATH_TRANSLATED var");
+    /* cgi_error returns a simple error page */
+    cgi_error(cgi, "No PATH_TRANSLATED var");
     return -1;
   }
+
+  /* The hdf.loadpaths variables specify where HDF and ClearSilver look for
+   * files on the file system.  We start setting that up here based on
+   * the directory of the file referenced */
   p = strrchr (cs_file, '/');
   if (p)
   {
     *p = '\0';
-    err = hdf_set_value (cgi->hdf, "hdf.loadpaths.0", cs_file);
+    err = hdf_set_value(cgi->hdf, "hdf.loadpaths.0", cs_file);
     chdir(cs_file);
     *p = '/';
     if (err)
@@ -56,13 +84,18 @@
       return -1;
     }
   }
-  err = hdf_read_file (cgi->hdf, "common.hdf");
+  /* Next, we look for a shared HDF static dataset in common.hdf */
+  err = hdf_read_file(cgi->hdf, "common.hdf");
   if (err && !nerr_handle(&err, NERR_NOT_FOUND))
   {
     cgi_neo_error(cgi, err);
     nerr_log_error(err);
     return -1;
   }
+  /* Next, we look for an HDF file for this specific page.  We first look
+   * for passedfile.html.hdf, then we check for a file by removing an extension
+   * from the file, so something like passedfile.html we'll look for
+   * passedfile.hdf */
   snprintf (hdf_file, sizeof(hdf_file), "%s.hdf", cs_file);
   err = hdf_read_file (cgi->hdf, hdf_file);
   if (err && !nerr_handle(&err, NERR_NOT_FOUND))
@@ -85,6 +118,9 @@
       return -1;
     }
   }
+  /* Lastly, we need to render a template.  The template is either the
+   * file that was passed to us, or its specificed by CGI.StaticContent
+   * in one of the HDF files we loaded above. */
   cs_file = hdf_get_value (cgi->hdf, "CGI.StaticContent", cs_file);
   err = cgi_display (cgi, cs_file);
   if (err != STATUS_OK)
diff -Nrub clearsilver-0.10.1/config.guess clearsilver-0.10.2/config.guess
--- clearsilver-0.10.1/config.guess	2005-06-30 11:51:48.000000000 -0700
+++ clearsilver-0.10.2/config.guess	2005-10-21 15:44:35.000000000 -0700
@@ -1,7 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
-#
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+#   Free Software Foundation, Inc.
+
+timestamp='2001-09-04'
+
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -22,22 +25,95 @@
 # the same distribution terms that you use for the rest of that program.
 
 # Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
+# Please send patches to <config-patches@gnu.org>.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
 # The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int dummy(){}" > $dummy.c ;
+	for c in cc gcc c89 ; do
+	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+	  if test $? = 0 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	rm -f $dummy.c $dummy.o $dummy.rel ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
 	PATH=$PATH:/.attbin ; export PATH
 fi
@@ -47,12 +123,55 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# Netbsd (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	# Determine the machine/vendor (is the vendor relevant).
+	case "${UNAME_MACHINE}" in
+	    amiga) machine=m68k-unknown ;;
+	    arm32) machine=arm-unknown ;;
+	    atari*) machine=m68k-atari ;;
+	    sun3*) machine=m68k-sun ;;
+	    mac68k) machine=m68k-apple ;;
+	    macppc) machine=powerpc-apple ;;
+	    hp3[0-9][05]) machine=m68k-hp ;;
+	    ibmrt|romp-ibm) machine=romp-ibm ;;
+	    *) machine=${UNAME_MACHINE}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE}" in
+	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
     alpha:OSF1:*:*)
 	if test $UNAME_RELEASE = "V4.0"; then
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -62,55 +181,72 @@
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	cat <<EOF >$dummy.s
+	.data
+\$Lformat:
+	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+	.text
 	.globl main
+	.align 4
 	.ent main
 main:
-	.frame \$30,0,\$26,0
-	.prologue 0
-	.long 0x47e03d80 # implver $0
-	lda \$2,259
-	.long 0x47e20c21 # amask $2,$1
-	srl \$1,8,\$2
-	sll \$2,2,\$2
-	sll \$0,3,\$0
-	addl \$1,\$0,\$0
-	addl \$2,\$0,\$0
-	ret \$31,(\$26),1
+	.frame \$30,16,\$26,0
+	ldgp \$29,0(\$27)
+	.prologue 1
+	.long 0x47e03d80 # implver \$0
+	lda \$2,-1
+	.long 0x47e20c21 # amask \$2,\$1
+	lda \$16,\$Lformat
+	mov \$0,\$17
+	not \$1,\$18
+	jsr \$26,printf
+	ldgp \$29,0(\$26)
+	mov 0,\$16
+	jsr \$26,exit
 	.end main
 EOF
-	${CC-cc} $dummy.s -o $dummy 2>/dev/null
+	eval $set_cc_for_build
+	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 	if test "$?" = 0 ; then
-		./$dummy
-		case "$?" in
-			7)
+		case `./$dummy` in
+			0-0)
 				UNAME_MACHINE="alpha"
 				;;
-			15)
+			1-0)
 				UNAME_MACHINE="alphaev5"
 				;;
-			14)
+			1-1)
 				UNAME_MACHINE="alphaev56"
 				;;
-			10)
+			1-101)
 				UNAME_MACHINE="alphapca56"
 				;;
-			16)
+			2-303)
 				UNAME_MACHINE="alphaev6"
 				;;
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
+			2-1307)
+				UNAME_MACHINE="alphaev68"
+				;;
 		esac
 	fi
 	rm -f $dummy.s $dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
 	exit 0 ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
 	exit 0 ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-cbm-sysv4
+	echo m68k-unknown-sysv4
 	exit 0;;
-    amiga:NetBSD:*:*)
-      echo m68k-cbm-netbsd${UNAME_RELEASE}
-      exit 0 ;;
     amiga:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -135,16 +271,16 @@
     wgrisc:OpenBSD:*:*)
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit 0;;
-    arm32:NetBSD:*:*)
-	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
-    SR2?01:HI-UX/MPP:*:*)
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
 	exit 0;;
-    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
 		echo pyramid-pyramid-sysv3
@@ -197,21 +333,41 @@
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
 	exit 0 ;;
-    atari*:NetBSD:*:*)
-	echo m68k-atari-netbsd${UNAME_RELEASE}
+    sparc*:NetBSD:*)
+	echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
 	exit 0 ;;
     atari*:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    sun3*:NetBSD:*:*)
-	echo m68k-sun-netbsd${UNAME_RELEASE}
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
 	exit 0 ;;
     sun3*:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    mac68k:NetBSD:*:*)
-	echo m68k-apple-netbsd${UNAME_RELEASE}
-	exit 0 ;;
     mac68k:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -224,9 +380,6 @@
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
-    macppc:NetBSD:*:*)
-        echo powerpc-apple-netbsd${UNAME_RELEASE}
-        exit 0 ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit 0 ;;
@@ -236,12 +389,14 @@
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
 	exit 0 ;;
-    2020:CLIX:*:*)
+    2020:CLIX:*:* | 2430:CLIX:*:*)
 	echo clipper-intergraph-clix${UNAME_RELEASE}
 	exit 0 ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 #ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
 #else
 	int main (argc, argv) int argc; char *argv[]; {
@@ -260,12 +415,15 @@
 	  exit (-1);
 	}
 EOF
-	${CC-cc} $dummy.c -o $dummy \
+	$CC_FOR_BUILD $dummy.c -o $dummy \
 	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm $dummy.c $dummy && exit 0
+	  && rm -f $dummy.c $dummy && exit 0
 	rm -f $dummy.c $dummy
 	echo mips-mips-riscos${UNAME_RELEASE}
 	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
 	exit 0 ;;
@@ -281,14 +439,17 @@
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
-        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
-	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
 		echo m88k-dg-dgux${UNAME_RELEASE}
 	else
 		echo m88k-dg-dguxbcs${UNAME_RELEASE}
 	fi
-        else echo i586-dg-dgux${UNAME_RELEASE}
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
         fi
  	exit 0 ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
@@ -310,11 +471,20 @@
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
 	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i?86:AIX:*:*)
+    i*86:AIX:*:*)
 	echo i386-ibm-aix
 	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
 		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
@@ -326,7 +496,7 @@
 			exit(0);
 			}
 EOF
-		${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
 		rm -f $dummy.c $dummy
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
@@ -335,9 +505,9 @@
 		echo rs6000-ibm-aix3.2
 	fi
 	exit 0 ;;
-    *:AIX:*:4)
+    *:AIX:*:[45])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -345,7 +515,7 @@
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=4.${UNAME_RELEASE}
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
 	exit 0 ;;
@@ -355,7 +525,7 @@
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
 	exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
 	exit 0 ;;                           # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
@@ -371,11 +541,32 @@
 	echo m68k-hp-bsd4.4
 	exit 0 ;;
     9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 )
+	    9000/[678][0-9][0-9])
+              case "${HPUX_REV}" in
+                11.[0-9][0-9])
+                  if [ -x /usr/bin/getconf ]; then
+                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                        esac ;;
+                    esac
+                  fi ;;
+              esac
+              if [ "${HP_ARCH}" = "" ]; then
+	      eval $set_cc_for_build
               sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
               #include <stdlib.h>
               #include <unistd.h>
 
@@ -406,13 +597,19 @@
                   exit (0);
               }
 EOF
-	(${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+	    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+	    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
 	rm -f $dummy.c $dummy
+	fi ;;
 	esac
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
     3050*:HI-UX:*:*)
+	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#include <unistd.h>
 	int
@@ -438,7 +635,7 @@
 	  exit (0);
 	}
 EOF
-	${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
 	rm -f $dummy.c $dummy
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
@@ -448,10 +645,7 @@
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
 	exit 0 ;;
-    *9??*:MPE*:*:*)
-	echo hppa1.0-hp-mpeix
-	exit 0 ;;
-    *9??*:MPE*:*:*)
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
 	exit 0 ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
@@ -460,7 +654,7 @@
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
 	exit 0 ;;
-    i?86:OSF1:*:*)
+    i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
 	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
@@ -470,6 +664,9 @@
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
 	exit 0 ;;
+    hppa*:OpenBSD:*:*)
+	echo hppa-unknown-openbsd
+	exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
         exit 0 ;;
@@ -492,57 +689,50 @@
 	echo xmp-cray-unicos
         exit 0 ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE}
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     CRAY*[A-Z]90:*:*:*)
 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE}
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3D:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     CRAY*T3E:*:*:*)
-	echo t3e-cray-unicosmk${UNAME_RELEASE}
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     CRAY-2:*:*:*)
 	echo cray2-cray-unicos
         exit 0 ;;
-    F300:UNIX_System_V:*:*)
-        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
-    F301:UNIX_System_V:*:*)
-       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
-       exit 0 ;;
-    hp3[0-9][05]:NetBSD:*:*)
-	echo m68k-hp-netbsd${UNAME_RELEASE}
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit 0 ;;
     hp300:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
-    i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit 0 ;;
     *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
-	if test -x /usr/bin/objformat; then
-	    if test "elf" = "`/usr/bin/objformat`"; then
-		echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
-		exit 0
-	    fi
-	fi
 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit 0 ;;
-    *:NetBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
     *:OpenBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
@@ -552,6 +742,18 @@
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i386-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
 	exit 0 ;;
@@ -561,120 +763,99 @@
     *:GNU:*:*)
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
-    *:Linux:*:*)
-#	# uname on the ARM produces all sorts of strangeness, and we need to
-#	# filter it out.
-#	case "$UNAME_MACHINE" in
-#	  armv*)		      UNAME_MACHINE=$UNAME_MACHINE ;;
-#	  arm* | sa110*)	      UNAME_MACHINE="arm" ;;
-#	esac
-
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
+	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
+	esac
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us.
-	ld_help_string=`ld --help 2>&1`
-	ld_supported_emulations=`echo $ld_help_string \
-			 | sed -ne '/supported emulations:/!d
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	ld_supported_targets=`cd /; ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
 				    s/[ 	][ 	]*/ /g
-				    s/.*supported emulations: *//
+				    s/.*supported targets: *//
 				    s/ .*//
 				    p'`
-        case "$ld_supported_emulations" in
-	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
-	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
-	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  elf32arm)   echo "${UNAME_MACHINE}-unknown-linux-gnu"     ; exit 0 ;;
-	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
-	esac
-
-	if test "${UNAME_MACHINE}" = "alpha" ; then
-		sed 's/^	//'  <<EOF >$dummy.s
-		.globl main
-		.ent main
-	main:
-		.frame \$30,0,\$26,0
-		.prologue 0
-		.long 0x47e03d80 # implver $0
-		lda \$2,259
-		.long 0x47e20c21 # amask $2,$1
-		srl \$1,8,\$2
-		sll \$2,2,\$2
-		sll \$0,3,\$0
-		addl \$1,\$0,\$0
-		addl \$2,\$0,\$0
-		ret \$31,(\$26),1
-		.end main
-EOF
-		LIBC=""
-		${CC-cc} $dummy.s -o $dummy 2>/dev/null
-		if test "$?" = 0 ; then
-			./$dummy
-			case "$?" in
-			7)
-				UNAME_MACHINE="alpha"
-				;;
-			15)
-				UNAME_MACHINE="alphaev5"
-				;;
-			14)
-				UNAME_MACHINE="alphaev56"
-				;;
-			10)
-				UNAME_MACHINE="alphapca56"
-				;;
-			16)
-				UNAME_MACHINE="alphaev6"
-				;;
-			esac
-
-			objdump --private-headers $dummy | \
-			  grep ld.so.1 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
-		fi
-		rm -f $dummy.s $dummy
-		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
-	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >$dummy.c <<EOF
-#ifdef __cplusplus
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
-  printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
-  printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	  ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
-	  rm -f $dummy.c $dummy
-	else
-	  # Either a pre-BFD a.out linker (linux-gnuoldld)
-	  # or one that does not give us useful --help.
-	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
-	  # If ld does not provide *any* "supported emulations:"
-	  # that means it is gnuoldld.
-	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
-	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
-	  case "${UNAME_MACHINE}" in
-	  i?86)
-	    VENDOR=pc;
-	    ;;
-	  *)
-	    VENDOR=unknown;
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
 	    ;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;		
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
 	  esac
 	  # Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
 	  cat >$dummy.c <<EOF
 #include <features.h>
 #ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
 #else
 	int main (argc, argv) int argc; char *argv[]; {
@@ -682,28 +863,30 @@
 #ifdef __ELF__
 # ifdef __GLIBC__
 #  if __GLIBC__ >= 2
-    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+    printf ("%s-pc-linux-gnu\n", argv[1]);
 #  else
-    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
 #  endif
 # else
-   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
 # endif
 #else
-  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+  printf ("%s-pc-linux-gnuaout\n", argv[1]);
 #endif
   return 0;
 }
 EOF
-	  ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
 	  rm -f $dummy.c $dummy
-	fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
-# are messed up and put the nodename in both sysname and nodename.
-    i?86:DYNIX/ptx:4*:*)
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
 	echo i386-sequent-sysv4
 	exit 0 ;;
-    i?86:UNIX_SV:4.2MP:2.*)
+    i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
         # I am not positive that other SVR4 systems won't match this,
@@ -711,14 +894,23 @@
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	fi
 	exit 0 ;;
-    i?86:*:3.2:*)
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
@@ -727,19 +919,20 @@
 		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
+		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
 	exit 0 ;;
-    i?86:UnixWare:*:*)
-	if /bin/uname -X 2>/dev/null >/dev/null ; then
-	  (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-	    && UNAME_MACHINE=i586
-	fi
-	echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
 	exit 0 ;;
     pc:*:*:*)
+	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
@@ -763,7 +956,7 @@
 	exit 0 ;;
     M68*:*:R3V[567]*:*)
 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -774,21 +967,24 @@
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:*)
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit 0 ;;
-    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
 	echo sparc-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+    rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
 	exit 0 ;;
@@ -806,7 +1002,7 @@
 		echo ns32k-sni-sysv
 	fi
 	exit 0 ;;
-    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                            # says <Richard.M.Bartel@ccMail.Census.GOV>
         echo i586-unisys-sysv4
         exit 0 ;;
@@ -819,13 +1015,17 @@
 	# From seanf@swdc.stratus.com.
 	echo i860-stratus-sysv4
 	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
     mc68*:A/UX:*:*)
 	echo m68k-apple-aux${UNAME_RELEASE}
 	exit 0 ;;
-    news*:NEWS-OS:*:6*)
+    news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
 	exit 0 ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
@@ -853,11 +1053,76 @@
     *:Rhapsody:*:*)
 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
 	exit 0 ;;
+    *:Darwin:*:*)
+	echo `uname -p`-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	if test "${UNAME_MACHINE}" = "x86pc"; then
+		UNAME_MACHINE=pc
+	fi
+	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-[KW]:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
+eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
@@ -944,11 +1209,24 @@
 #endif
 
 #if defined (vax)
-#if !defined (ultrix)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
   printf ("vax-dec-bsd\n"); exit (0);
-#else
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
   printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# endif
 #endif
 
 #if defined (alliant) && defined (i860)
@@ -959,7 +1237,7 @@
 }
 EOF
 
-${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
 rm -f $dummy.c $dummy
 
 # Apollos put the system type in the environment.
@@ -992,6 +1270,48 @@
     esac
 fi
 
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
 
 exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -Nrub clearsilver-0.10.1/config.sub clearsilver-0.10.2/config.sub
--- clearsilver-0.10.1/config.sub	2005-06-30 11:51:48.000000000 -0700
+++ clearsilver-0.10.2/config.sub	2005-10-21 15:44:36.000000000 -0700
@@ -1,6 +1,10 @@
 #! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+#   Free Software Foundation, Inc.
+
+timestamp='2001-09-07'
+
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # can handle that machine.  It does not imply ALL GNU software can.
@@ -25,6 +29,8 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# Please send patches to <config-patches@gnu.org>.
+#
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
@@ -45,30 +51,73 @@
 #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-if [ x$1 = x ]
-then
-	echo Configuration name missing. 1>&2
-	echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
-	echo "or     $0 ALIAS" 1>&2
-	echo where ALIAS is a recognized configuration type. 1>&2
-	exit 1
-fi
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
 
-# First pass through any local machine types.
-case $1 in
 	*local*)
+       # First pass through any local machine types.
 		echo $1
-		exit 0
-		;;
-	*)
-	;;
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
 esac
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  linux-gnu*)
+  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -94,15 +143,33 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple)
+	-apple | -axis)
 		os=
 		basic_machine=$1
 		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
 	-sco5)
-		os=sco3.2v5
+		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco4)
@@ -121,6 +188,9 @@
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-isc)
 		os=-isc2.2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -143,27 +213,60 @@
 	-psos*)
 		os=-psos
 		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 esac
 
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
-		| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
-		| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
-		| hppa2.0w \
-		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
-		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
-		| mipstx39 | mipstx39el | armv[34][lb] \
-		| sparc | sparclet | sparclite | sparc64 | v850)
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| c4x | clipper \
+	| d10v | d30v | dsp16xx \
+	| fr30 \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| m32r | m68000 | m68k | m88k | mcore \
+	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
+	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
+	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
+	| mipsisa32 \
+	| mn10200 | mn10300 \
+	| ns16k | ns32k \
+	| openrisc \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| s390 | s390x \
+	| sh | sh[34] | sh[34]eb | shbe | shle \
+	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
+	| stormy16 | strongarm \
+	| tahoe | thumb | tic80 | tron \
+	| v850 \
+	| we32k \
+	| x86 | xscale \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
-	i[34567]86)
+	i*86 | x86_64)
 	  basic_machine=$basic_machine-pc
 	  ;;
 	# Object if more than one company name word.
@@ -172,28 +275,64 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
-	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
-	      | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
-	      | hppa2.0w-* \
-	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
-	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
-	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
-	      | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\
-	      | mips64el-* | mips64orion-* | mips64orionel-*  \
-	      | mipstx39-* | mipstx39el-* \
-	      | f301-* | armv*-*)
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alphapca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armv*-* \
+	| bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c54x-* \
+	| clipper-* | cray2-* | cydra-* \
+	| d10v-* | d30v-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| m32r-* \
+	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | mcore-* \
+	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
+	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| s390-* | s390x-* \
+	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
+	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+	| ymp-* \
+	| z8k-*)
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
 		basic_machine=m68000-att
 		;;
 	3b*)
 		basic_machine=we32k-att
 		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
 	alliant | fx80)
 		basic_machine=fx80-alliant
 		;;
@@ -209,20 +348,24 @@
 		os=-sysv
 		;;
 	amiga | amiga-*)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		;;
 	amigaos | amigados)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-amigaos
 		;;
 	amigaunix | amix)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-sysv4
 		;;
 	apollo68)
 		basic_machine=m68k-apollo
 		os=-sysv
 		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -259,13 +402,16 @@
 		basic_machine=cray2-cray
 		os=-unicos
 		;;
-	[ctj]90-cray)
-		basic_machine=c90-cray
+	[cjt]90)
+		basic_machine=${basic_machine}-cray
 		os=-unicos
 		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
@@ -299,6 +445,10 @@
 	encore | umax | mmax)
 		basic_machine=ns32k-encore
 		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
 	fx2800)
 		basic_machine=i860-alliant
 		;;
@@ -309,6 +459,10 @@
 		basic_machine=tron-gmicro
 		os=-sysv
 		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
 	h3050r* | hiux*)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
@@ -317,6 +471,14 @@
 		basic_machine=h8300-hitachi
 		os=-hms
 		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
 	harris)
 		basic_machine=m88k-harris
 		os=-sysv3
@@ -332,13 +494,30 @@
 		basic_machine=m68k-hp
 		os=-hpux
 		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
 	hp9k2[0-9][0-9] | hp9k31[0-9])
 		basic_machine=m68000-hp
 		;;
 	hp9k3[2-9][0-9])
 		basic_machine=m68k-hp
 		;;
-	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
 		basic_machine=hppa1.1-hp
 		;;
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -347,35 +526,42 @@
 	hppa-next)
 		os=-nextstep3
 		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		os=-mpeix
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
 		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		os=-mpeix
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
 		;;
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
-		os=-mvs
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i[34567]86v32)
+	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
-	i[34567]86v4*)
+	i*86v4*)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
-	i[34567]86v)
+	i*86v)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
-	i[34567]86sol2)
+	i*86sol2)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
@@ -401,9 +587,17 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 	mipsel*-linux*)
 		basic_machine=mipsel-unknown
 		os=-linux-gnu
@@ -418,12 +612,32 @@
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
 		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
 	netwinder)
-		basic_machine=armv4l-corel
+		basic_machine=armv4l-rebel
 		os=-linux
 		;;
 	news | news700 | news800 | news900)
@@ -438,6 +652,10 @@
 		basic_machine=mips-sony
 		os=-newsos
 		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
 	next | m*-next )
 		basic_machine=m68k-next
 		case $os in
@@ -463,9 +681,32 @@
 		basic_machine=i960-intel
 		os=-nindy
 		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
 	np1)
 		basic_machine=np1-gould
 		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
 	pa-hitachi)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
@@ -483,28 +724,28 @@
         pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | nexen)
+	pentium | p5 | k5 | k6 | nexgen)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | k6 | 6x86)
+	pentiumpro | p6 | 6x86 | athlon)
 		basic_machine=i686-pc
 		;;
 	pentiumii | pentium2)
-		basic_machine=i786-pc
+		basic_machine=i686-pc
 		;;
-	pentium-* | p5-* | k5-* | nexen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-* | k6-* | 6x86-*)
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pn)
 		basic_machine=pn-gould
 		;;
-	power)	basic_machine=rs6000-ibm
+	power)	basic_machine=power-ibm
 		;;
 	ppc)	basic_machine=powerpc-unknown
 	        ;;
@@ -516,15 +757,37 @@
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	ppc64)	basic_machine=powerpc64-unknown
+	        ;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+	        ;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	ps2)
 		basic_machine=i386-ibm
 		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
 	rm[46]00)
 		basic_machine=mips-siemens
 		;;
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -532,6 +795,10 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sparclite-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
 	sps7)
 		basic_machine=m68k-bull
 		os=-sysv2
@@ -539,6 +806,13 @@
 	spur)
 		basic_machine=spur-unknown
 		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -579,10 +853,22 @@
 	sun386 | sun386i | roadrunner)
 		basic_machine=i386-sun
 		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
 	symmetry)
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+	t3e)
+		basic_machine=t3e-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -600,6 +886,10 @@
 		basic_machine=a29k-nyu
 		os=-sym1
 		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
 	vaxv)
 		basic_machine=vax-dec
 		os=-sysv
@@ -623,6 +913,18 @@
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	windows32)
+		basic_machine=i386-pc
+		os=-windows32-msvcrt
+		;;
 	xmp)
 		basic_machine=xmp-cray
 		os=-unicos
@@ -630,6 +932,10 @@
         xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -637,6 +943,15 @@
 
 # Here we handle the default manufacturer of certain CPU types.  It is in
 # some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
 	mips)
 		if [ x$os = x-linux-gnu ]; then
 			basic_machine=mips-unknown
@@ -653,13 +968,20 @@
 	vax)
 		basic_machine=vax-dec
 		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
 	pdp11)
 		basic_machine=pdp11-dec
 		;;
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sparc)
+	sh3 | sh4 | sh3eb | sh4eb)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
         cydra)
@@ -671,6 +993,19 @@
 	orion105)
 		basic_machine=clipper-highlevel
 		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	c4x*)
+		basic_machine=c4x-none
+		os=-coff
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
@@ -724,14 +1059,37 @@
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
-	      | -openstep* | -mpeix* | -oskit*)
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto*)
+		os=-nto-qnx
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -741,6 +1099,12 @@
 	-sunos6*)
 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
 		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
 	-osfrose*)
 		os=-osfrose
 		;;
@@ -756,12 +1120,18 @@
 	-acis*)
 		os=-aos
 		;;
+	-386bsd)
+		os=-bsd
+		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
 	-ns2 )
 	        os=-nextstep2
 		;;
+	-nsk*)
+		os=-nsk
+		;;
 	# Preserve the version number of sinix5.
 	-sinix5.*)
 		os=`echo $os | sed -e 's|sinix|sysv|'`
@@ -787,9 +1157,18 @@
 	# This must come after -sysvr4.
 	-sysv*)
 		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
 	-xenix)
 		os=-xenix
 		;;
+        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+	        os=-mint
+		;;
 	-none)
 		;;
 	*)
@@ -815,12 +1194,15 @@
 	*-acorn)
 		os=-riscix1.2
 		;;
-	arm*-corel)
+	arm*-rebel)
 		os=-linux
 		;;
 	arm*-semi)
 		os=-aout
 		;;
+	pdp10-*)
+		os=-tops20
+		;;
         pdp11-*)
 		os=-none
 		;;
@@ -839,6 +1221,15 @@
 		# default.
 		# os=-sunos4
 		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -851,6 +1242,15 @@
 	*-ibm)
 		os=-aix
 		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
 	*-hp)
 		os=-hpux
 		;;
@@ -911,9 +1311,21 @@
 	*-masscomp)
 		os=-rtu
 		;;
-	f301-fujitsu)
+	f30[01]-fujitsu | f700-fujitsu)
 		os=-uxpv
 		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
 	*)
 		os=-none
 		;;
@@ -935,10 +1347,10 @@
 			-aix*)
 				vendor=ibm
 				;;
-			-hpux*)
-				vendor=hp
+			-beos*)
+				vendor=be
 				;;
-			-mpeix*)
+			-hpux*)
 				vendor=hp
 				;;
 			-mpeix*)
@@ -959,7 +1371,7 @@
 			-genix*)
 				vendor=ns
 				;;
-			-mvs*)
+			-mvs* | -opened*)
 				vendor=ibm
 				;;
 			-ptx*)
@@ -971,9 +1383,29 @@
 			-aux*)
 				vendor=apple
 				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
 esac
 
 echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -Nrub clearsilver-0.10.1/configure clearsilver-0.10.2/configure
--- clearsilver-0.10.1/configure	2005-07-27 19:38:05.000000000 -0700
+++ clearsilver-0.10.2/configure	2005-12-14 16:26:08.000000000 -0800
@@ -308,7 +308,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S AR RANLIB ac_ct_RANLIB SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os USE_MINGW32 APXS_PATH PERL RUBY BUILD_WRAPPERS JAVA_PATH PYTHON PYTHON_INC PYTHON_LIB PYTHON_SITE EXTRA_UTL_SRC EXTRA_UTL_OBJS CSHARP_PATH LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S AR RANLIB ac_ct_RANLIB SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os _ACJNI_JAVAC USE_MINGW32 APXS_PATH PERL RUBY BUILD_WRAPPERS JAVA_PATH JAVA_INCLUDE_PATH PYTHON PYTHON_INC PYTHON_LIB PYTHON_SITE EXTRA_UTL_SRC EXTRA_UTL_OBJS CSHARP_PATH LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -5039,7 +5039,7 @@
           * ) MINGW32=no;;
 esac
 
-if test "x$ac_cv_mingw32" = "xyes"; then
+if test "x$MINGW32" = "xyes"; then
   CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__"
   USE_MINGW32="USE_MINGW32 = 1"
 else
@@ -6003,13 +6003,14 @@
 echo $ECHO_N "checking for python includes... $ECHO_C" >&6
   python_inc=no
   python_search_path="/neo/opt /usr/local /usr /c"
-  python_versions="2.3 2.2 2.1 2.0 1.5 22 21 20 15"
+  python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
   if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then
     python_bin=$cs_cv_python_path
     vers=`$python_bin -c "import sys; print sys.version[:3]"`
     py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"`
     python_inc=$py_inst_dir/include/python$vers
     python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers"
+    python_site=$py_inst_dir/lib/python$vers/site-packages
   else
     for vers in $python_versions; do
       for path in $python_search_path; do
@@ -6019,11 +6020,13 @@
 	if test -f $path/include/python$vers/Python.h; then
 	  python_inc=$path/include/python$vers
 	  python_lib="-L$path/lib/python$vers/config -lpython$vers"
+	  python_site=$path/lib/python$vers/site-packages
 	  break 2
 	fi
 			if test -f $path/python$vers/include/Python.h; then
 	  python_inc=$path/python$vers/include
 	  python_lib="-L$path/python$vers/libs -lpython$vers"
+	  python_site=$path/python$vers/Lib/site-packages
 	  break 2
 	fi
       done
@@ -6042,7 +6045,9 @@
     PYTHON=$python_bin
     PYTHON_INC="-I$python_inc"
     PYTHON_LIB=$python_lib
-    PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[0]"`
+    if test ! $?PYTHON_SITE; then
+	PYTHON_SITE=$python_site
+    fi
     BUILD_WRAPPERS="$BUILD_WRAPPERS python"
   fi
 fi
@@ -6198,10 +6203,123 @@
     echo "$as_me:$LINENO: result: not found" >&5
 echo "${ECHO_T}not found" >&6
     JAVA_PATH=
+    JAVA_INCLUDE_PATH=
   else
     echo "$as_me:$LINENO: result: found $java_path" >&5
 echo "${ECHO_T}found $java_path" >&6
     JAVA_PATH="$java_path"
+    JAVAC="$java_path/bin/javac"
+    _ACJNI_JAVAC=$JAVAC
+
+
+JNI_INCLUDE_DIRS=""
+
+test "x$JAVAC" = x && { { echo "$as_me:$LINENO: error: '$JAVAC' undefined" >&5
+echo "$as_me: error: '$JAVAC' undefined" >&2;}
+   { (exit 1); exit 1; }; }
+# Extract the first word of "$JAVAC", so it can be a program name with args.
+set dummy $JAVAC; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path__ACJNI_JAVAC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $_ACJNI_JAVAC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path__ACJNI_JAVAC="$_ACJNI_JAVAC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path__ACJNI_JAVAC="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path__ACJNI_JAVAC" && ac_cv_path__ACJNI_JAVAC="no"
+  ;;
+esac
+fi
+_ACJNI_JAVAC=$ac_cv_path__ACJNI_JAVAC
+
+if test -n "$_ACJNI_JAVAC"; then
+  echo "$as_me:$LINENO: result: $_ACJNI_JAVAC" >&5
+echo "${ECHO_T}$_ACJNI_JAVAC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+test "x$_ACJNI_JAVAC" = xno && { { echo "$as_me:$LINENO: error: $JAVAC could not be found in path" >&5
+echo "$as_me: error: $JAVAC could not be found in path" >&2;}
+   { (exit 1); exit 1; }; }
+
+
+# find the include directory relative to the javac executable
+_cur=""$_ACJNI_JAVAC""
+while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
+        echo "$as_me:$LINENO: checking symlink for $_cur" >&5
+echo $ECHO_N "checking symlink for $_cur... $ECHO_C" >&6
+        _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
+        case "$_slink" in
+        /*) _cur="$_slink";;
+        # 'X' avoids triggering unwanted echo options.
+        *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[^/]*$::'`"$_slink";;
+        esac
+        echo "$as_me:$LINENO: result: $_cur" >&5
+echo "${ECHO_T}$_cur" >&6
+done
+_ACJNI_FOLLOWED="$_cur"
+
+_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`
+case "$host_os" in
+        darwin*)        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
+                        _JINC="$_JTOPDIR/Headers";;
+        *)              _JINC="$_JTOPDIR/include";;
+esac
+if test -f "$_JINC/jni.h"; then
+        JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
+else
+        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
+        if test -f "$_JTOPDIR/include/jni.h"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
+        else
+                { { echo "$as_me:$LINENO: error: cannot find java include files" >&5
+echo "$as_me: error: cannot find java include files" >&2;}
+   { (exit 1); exit 1; }; }
+        fi
+fi
+
+# get the likely subdirectories for system specific java includes
+case "$host_os" in
+bsdi*)          _JNI_INC_SUBDIRS="bsdos";;
+linux*)         _JNI_INC_SUBDIRS="linux genunix";;
+osf*)           _JNI_INC_SUBDIRS="alpha";;
+solaris*)       _JNI_INC_SUBDIRS="solaris";;
+mingw*)			_JNI_INC_SUBDIRS="win32";;
+cygwin*)		_JNI_INC_SUBDIRS="win32";;
+*)              _JNI_INC_SUBDIRS="genunix";;
+esac
+
+# add any subdirectories that are present
+for JINCSUBDIR in $_JNI_INC_SUBDIRS
+do
+        if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
+        fi
+done
+
+    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+    do
+	JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR"
+    done
     BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni"
   fi
 fi
@@ -6498,6 +6616,7 @@
 
 
 
+
           ac_config_files="$ac_config_files rules.mk"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -7134,12 +7253,14 @@
 s,@host_cpu@,$host_cpu,;t t
 s,@host_vendor@,$host_vendor,;t t
 s,@host_os@,$host_os,;t t
+s,@_ACJNI_JAVAC@,$_ACJNI_JAVAC,;t t
 s,@USE_MINGW32@,$USE_MINGW32,;t t
 s,@APXS_PATH@,$APXS_PATH,;t t
 s,@PERL@,$PERL,;t t
 s,@RUBY@,$RUBY,;t t
 s,@BUILD_WRAPPERS@,$BUILD_WRAPPERS,;t t
 s,@JAVA_PATH@,$JAVA_PATH,;t t
+s,@JAVA_INCLUDE_PATH@,$JAVA_INCLUDE_PATH,;t t
 s,@PYTHON@,$PYTHON,;t t
 s,@PYTHON_INC@,$PYTHON_INC,;t t
 s,@PYTHON_LIB@,$PYTHON_LIB,;t t
diff -Nrub clearsilver-0.10.1/configure.in clearsilver-0.10.2/configure.in
--- clearsilver-0.10.1/configure.in	2005-06-30 18:49:06.000000000 -0700
+++ clearsilver-0.10.2/configure.in	2005-12-02 03:03:35.000000000 -0800
@@ -75,7 +75,7 @@
 ])
 
 AC_MINGW32()
-if test "x$ac_cv_mingw32" = "xyes"; then
+if test "x$MINGW32" = "xyes"; then
   CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__"
   USE_MINGW32="USE_MINGW32 = 1"
 else
@@ -246,13 +246,14 @@
   AC_MSG_CHECKING(for python includes)
   python_inc=no
   python_search_path="/neo/opt /usr/local /usr /c"
-  python_versions="2.3 2.2 2.1 2.0 1.5 22 21 20 15"
+  python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"
   if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then
     python_bin=$cs_cv_python_path
     vers=`$python_bin -c "import sys; print sys.version[[:3]]"`
     py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"`
     python_inc=$py_inst_dir/include/python$vers
     python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers"
+    python_site=$py_inst_dir/lib/python$vers/site-packages
   else
     for vers in $python_versions; do
       for path in $python_search_path; do
@@ -262,6 +263,7 @@
 	if test -f $path/include/python$vers/Python.h; then
 	  python_inc=$path/include/python$vers
 	  python_lib="-L$path/lib/python$vers/config -lpython$vers"
+	  python_site=$path/lib/python$vers/site-packages
 	  break 2
 	fi
 	dnl This is currently special cased mostly for Windows
@@ -269,6 +271,7 @@
 	if test -f $path/python$vers/include/Python.h; then
 	  python_inc=$path/python$vers/include
 	  python_lib="-L$path/python$vers/libs -lpython$vers"
+	  python_site=$path/python$vers/Lib/site-packages
 	  break 2
 	fi
       done
@@ -285,7 +288,9 @@
     PYTHON=$python_bin
     PYTHON_INC="-I$python_inc"
     PYTHON_LIB=$python_lib
-    PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[[0]]"`
+    if test ! $?PYTHON_SITE; then
+	PYTHON_SITE=$python_site
+    fi
     BUILD_WRAPPERS="$BUILD_WRAPPERS python"
   fi
 fi
@@ -403,9 +408,17 @@
   if test "x$java_path" = "xno"; then
     AC_MSG_RESULT(not found)
     JAVA_PATH=
+    JAVA_INCLUDE_PATH=
   else
     AC_MSG_RESULT(found $java_path)
     JAVA_PATH="$java_path"
+    JAVAC="$java_path/bin/javac"
+    _ACJNI_JAVAC=$JAVAC
+    AC_JNI_INCLUDE_DIR
+    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+    do
+	JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR"
+    done
     BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni"
   fi
 fi
@@ -466,6 +479,7 @@
 AC_SUBST(RUBY)
 AC_SUBST(BUILD_WRAPPERS)
 AC_SUBST(JAVA_PATH)
+AC_SUBST(JAVA_INCLUDE_PATH)
 AC_SUBST(PYTHON)
 AC_SUBST(PYTHON_INC)
 AC_SUBST(PYTHON_LIB)
diff -Nrub clearsilver-0.10.1/cs/cs.h clearsilver-0.10.2/cs/cs.h
--- clearsilver-0.10.1/cs/cs.h	2005-06-30 18:14:21.000000000 -0700
+++ clearsilver-0.10.2/cs/cs.h	2005-11-30 19:58:44.000000000 -0800
@@ -105,7 +105,7 @@
 typedef struct _arg
 {
   CSTOKEN_TYPE op_type;
-  unsigned char *s;
+  char *s;
   long int n;
   int alloc;
   struct _funct *function;
@@ -145,6 +145,9 @@
   char *s;
   long int n;
   HDF *h;
+  int first;  /* This local is the "first" item in an each/loop */
+  int last;   /* This local is the "last" item in an loop, each is calculated
+               explicitly based on hdf_obj_next() in _builtin_last() */
   struct _local_map *next;
 } CS_LOCAL_MAP;
 
@@ -159,8 +162,9 @@
   struct _macro *next;
 } CS_MACRO;
 
-typedef NEOERR* (*CSFUNCTION)(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result);
-typedef NEOERR* (*CSSTRFUNC)(const unsigned char *str, unsigned char **ret);
+typedef NEOERR* (*CSFUNCTION)(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                              CSARG *result);
+typedef NEOERR* (*CSSTRFUNC)(const char *str, char **ret);
 
 struct _funct
 {
@@ -185,13 +189,18 @@
   int taglen;
 
   ULIST *stack;
-  ULIST *alloc;
+  ULIST *alloc;         /* list of strings owned by CSPARSE and free'd when
+                           its destroyed */
   CSTREE *tree;
   CSTREE *current;
   CSTREE **next;
 
   HDF *hdf;
 
+  struct _parse *parent;  /* set on internally created parse instances to point
+                             at the parent.  This can be used for hierarchical
+                             scope in the future. */
+
   CS_LOCAL_MAP *locals;
   CS_MACRO *macros;
   CS_FUNCTION *functions;
@@ -200,6 +209,9 @@
   void *output_ctx;
   CSOUTFUNC output_cb;
 
+  /* Global hdf struct */
+  /* smarti:  Added for support for global hdf under local hdf */
+  HDF *global_hdf;
 };
 
 /*
diff -Nrub clearsilver-0.10.1/cs/csparse.c clearsilver-0.10.2/cs/csparse.c
--- clearsilver-0.10.1/cs/csparse.c	2005-06-30 18:04:34.000000000 -0700
+++ clearsilver-0.10.2/cs/csparse.c	2005-12-02 03:04:37.000000000 -0800
@@ -105,7 +105,7 @@
 static NEOERR *alt_eval (CSPARSE *parse, CSTREE *node, CSTREE **next);
 
 static NEOERR *render_node (CSPARSE *parse, CSTREE *node);
-static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, BOOL init_funcs);
+static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, CSPARSE *parent);
 static int rearrange_for_call(CSARG **args);
 
 typedef struct _cmds
@@ -192,6 +192,7 @@
   return STATUS_OK;
 }
 
+/* TODO: make these deallocations linear and not recursive */
 static void dealloc_arg (CSARG **arg)
 {
   CSARG *p;
@@ -579,6 +580,7 @@
 {
   CS_LOCAL_MAP *map;
   char *c;
+  HDF *ret_hdf;
 
   map = lookup_map (parse, name, &c);
   if (map && map->type == CS_TYPE_VAR)
@@ -592,7 +594,13 @@
       return hdf_get_obj (map->h, c+1);
     }
   }
-  return hdf_get_obj (parse->hdf, name);
+  /* smarti:  Added support for global hdf under local hdf */
+  /* return hdf_get_obj (parse->hdf, name); */
+  ret_hdf = hdf_get_obj (parse->hdf, name);
+  if (ret_hdf == NULL && parse->global_hdf != NULL) {
+    ret_hdf = hdf_get_obj (parse->global_hdf, name);
+  }
+  return ret_hdf;
 }
 
 /* Ugh, I have to write the same walking code because I can't grab the
@@ -657,6 +665,7 @@
 {
   CS_LOCAL_MAP *map;
   char *c;
+  char* retval;
 
   map = lookup_map (parse, name, &c);
   if (map) 
@@ -691,7 +700,13 @@
       return map->s;
     }
   }
-  return hdf_get_value (parse->hdf, name, NULL);
+  /* smarti:  Added support for global hdf under local hdf */
+  /* return hdf_get_value (parse->hdf, name, NULL); */
+  retval = hdf_get_value (parse->hdf, name, NULL);
+  if (retval == NULL && parse->global_hdf != NULL) {
+    retval = hdf_get_value (parse->global_hdf, name, NULL);
+  }
+  return retval;
 }
 
 long int var_int_lookup (CSPARSE *parse, char *name)
@@ -2099,7 +2114,7 @@
 
       /* Ok, we need our own copy of the string to pass to
        * cs_parse_string... */
-      if (val.alloc) {
+      if (val.alloc && (val.op_type & CS_TYPE_STRING)) {
 	val.alloc = 0;
       }
       else 
@@ -2112,15 +2127,13 @@
       }
 
       do {
-	err = cs_init_internal(&cs, parse->hdf, FALSE);
+	err = cs_init_internal(&cs, parse->hdf, parse);
 	if (err) break;
-	cs->functions = parse->functions;
 	err = cs_parse_string(cs, s, strlen(s));
 	if (err) break;
 	err = cs_render(cs, parse->output_ctx, parse->output_cb);
 	if (err) break;
       } while (0);
-      cs->functions = NULL;
       cs_destroy(&cs);
     }
   }
@@ -2154,9 +2167,8 @@
     {
       CSPARSE *cs = NULL;
       do {
-	err = cs_init_internal(&cs, parse->hdf, FALSE);
+	err = cs_init_internal(&cs, parse->hdf, parse);
 	if (err) break;
-	cs->functions = parse->functions;
 	err = cs_parse_file(cs, s);
 	if (!(node->flags & CSF_REQUIRED))
 	{
@@ -2166,7 +2178,6 @@
 	err = cs_render(cs, parse->output_ctx, parse->output_cb);
 	if (err) break;
       } while (0);
-      cs->functions = NULL;
       cs_destroy(&cs);
     }
   }
@@ -2381,6 +2392,8 @@
       each_map.type = CS_TYPE_VAR;
       each_map.name = node->arg1.s;
       each_map.next = parse->locals;
+      each_map.first = 1;
+      each_map.last = 0;
       parse->locals = &each_map;
 
       do
@@ -2388,12 +2401,16 @@
 	child = hdf_obj_child (var);
 	while (child != NULL)
 	{
+          /* We don't explicitly set each_map.last here since checking
+           * requires a function call, so we move the check to _builtin_last
+           * so it only makes the call if last() is being used */
 	  each_map.h = child;
 	  err = render_node (parse, node->case_0);
           if (each_map.map_alloc) {
             free(each_map.s);
             each_map.s = NULL;
           }
+          if (each_map.first) each_map.first = 0;
 	  if (err != STATUS_OK) break;
 	  child = hdf_obj_next (child);
 	}
@@ -2748,7 +2765,7 @@
   {
     err = nerr_raise (NERR_PARSE, 
 	"%s Incorrect number of arguments, expected %d, got %d in call to macro %s: %s",
-	find_context(parse, -1, tmp, sizeof(tmp)), macro->n_args, x, 
+	find_context(parse, -1, tmp, sizeof(tmp)), macro->n_args, nargs, 
 	macro->name, arg);
   }
   if (err)
@@ -2774,11 +2791,18 @@
   int x;
 
   macro = node->arg1.macro;
+  if (macro->n_args)
+  {
   call_map = (CS_LOCAL_MAP *) calloc (macro->n_args, sizeof(CS_LOCAL_MAP));
   if (call_map == NULL)
     return nerr_raise (NERR_NOMEM, 
 	"Unable to allocate memory for call_map in call_eval of %s", 
 	macro->name);
+  }
+  else
+  {
+    call_map = NULL;
+  }
 
   darg = macro->args;
   carg = node->vargs;
@@ -2853,7 +2877,7 @@
   {
     if (call_map[x].map_alloc) free(call_map[x].s);
   }
-  free (call_map);
+  if (call_map) free (call_map);
 
   *next = node->next;
   return nerr_pass(err);
@@ -3116,17 +3140,20 @@
     each_map.type = CS_TYPE_NUM;
     each_map.name = node->arg1.s;
     each_map.next = parse->locals;
+    each_map.first = 1;
     parse->locals = &each_map;
 
     var = start;
     for (x = 0, var = start; x < iter; x++, var += step)
     {
+      if (x == iter - 1) each_map.last = 1;
       each_map.n = var;
       err = render_node (parse, node->case_0);
       if (each_map.map_alloc) {
         free(each_map.s);
         each_map.s = NULL;
       }
+      if (each_map.first) each_map.first = 0;
       if (err != STATUS_OK) break;
     } 
 
@@ -3172,7 +3199,8 @@
 
 /* **** Functions ******************************************** */
 
-static NEOERR *_register_function(CSPARSE *parse, char *funcname, int n_args, CSFUNCTION function)
+static NEOERR *_register_function(CSPARSE *parse, const char *funcname,
+                                  int n_args, CSFUNCTION function)
 {
   CS_FUNCTION *csf;
 
@@ -3207,11 +3235,75 @@
   return STATUS_OK;
 }
 
+/* This is similar to python's PyArg_ParseTuple, :
+ *   s - string (allocated)
+ *   i - int
+ *   A - arg ptr (maybe later)
+ */
+static NEOERR * cs_arg_parsev(CSPARSE *parse, CSARG *args, char *fmt, 
+    va_list ap) 
+{
+  NEOERR *err = STATUS_OK;
+  char **s;
+  long int *i;
+  CSARG val;
+
+  while (*fmt || args || err)
+  {
+    memset(&val, 0, sizeof(val));
+    err = eval_expr(parse, args, &val);
+    if (err) return nerr_pass(err);
+
+    switch (*fmt)
+    {
+      case 's':
+	s = va_arg(ap, char **);
+	if (s == NULL)
+	{
+	  err = nerr_raise(NERR_ASSERT, 
+	      "Invalid number of arguments in call to cs_arg_parse");
+	  break;
+	}
+	*s = arg_eval_str_alloc(parse, &val);
+	break;
+      case 'i':
+	i = va_arg(ap, long int *);
+	if (i == NULL)
+	{
+	  err = nerr_raise(NERR_ASSERT, 
+	      "Invalid number of arguments in call to cs_arg_parse");
+	  break;
+	}
+	*i = arg_eval_num(parse, &val);
+	break;
+      default:
+	break;
+    }
+    fmt++;
+    args = args->next;
+    if (val.alloc) free(val.s);
+  }
+  if (err) return nerr_pass(err);
+  return STATUS_OK;
+}
+
+static NEOERR * cs_arg_parse(CSPARSE *parse, CSARG *args, char *fmt, ...)
+{
+  NEOERR *err;
+  va_list ap;
+
+  va_start(ap, fmt);
+  err = cs_arg_parsev(parse, args, fmt, ap);
+  va_end(ap);
+  return nerr_pass(err);
+}
+
 static NEOERR * _builtin_subcount(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result)
 {
   HDF *obj;
   int count = 0;
 
+  /* default for non-vars is 0 children */
   result->op_type = CS_TYPE_NUM;
   result->n = 0;
 
@@ -3229,11 +3321,6 @@
     }
     result->n = count;
   }
-  else
-  {
-    // everything else has zero children
-    result->n = 0;
-  }
 
   return STATUS_OK;
 }
@@ -3242,6 +3329,7 @@
 {
   HDF *obj;
 
+  /* non var/string objects have 0 length */
   result->op_type = CS_TYPE_NUM;
   result->n = 0;
 
@@ -3291,67 +3379,105 @@
   return STATUS_OK;
 }
 
-/* This is similar to python's PyArg_ParseTuple, :
- *   s - string (allocated)
- *   i - int
- *   A - arg ptr (maybe later)
- */
-static NEOERR * cs_arg_parsev(CSPARSE *parse, CSARG *args, char *fmt, 
-    va_list ap) 
+/* Check to see if a local variable is the first in an each/loop sequence */
+static NEOERR * _builtin_first(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                               CSARG *result)
 {
-  NEOERR *err = STATUS_OK;
-  char **s;
-  long int *i;
-  CSARG val;
+  CS_LOCAL_MAP *map;
+  char *c;
 
-  while (*fmt || args || err)
-  {
-    memset(&val, 0, sizeof(val));
-    err = eval_expr(parse, args, &val);
-    if (err) return nerr_pass(err);
+  /* default is "not first" */
+  result->op_type = CS_TYPE_NUM;
+  result->n = 0;
 
-    switch (*fmt)
-    {
-      case 's':
-	s = va_arg(ap, char **);
-	if (s == NULL)
+  /* Only applies to possible local vars */
+  if ((args->op_type & CS_TYPE_VAR) && !strchr(args->s, '.'))
 	{
-	  err = nerr_raise(NERR_ASSERT, 
-	      "Invalid number of arguments in call to cs_arg_parse");
-	  break;
+    map = lookup_map (parse, args->s, &c);
+    if (map && map->first)
+      result->n = 1;
 	}
-	*s = arg_eval_str_alloc(parse, &val);
-	break;
-      case 'i':
-	i = va_arg(ap, long int *);
-	if (i == NULL)
+  return STATUS_OK;
+}
+
+/* Check to see if a local variable is the last in an each/loop sequence */
+/* TODO: consider making this work on regular HDF vars */
+static NEOERR * _builtin_last(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                               CSARG *result)
+{
+  CS_LOCAL_MAP *map;
+  char *c;
+
+  /* default is "not last" */
+  result->op_type = CS_TYPE_NUM;
+  result->n = 0;
+
+  /* Only applies to possible local vars */
+  if ((args->op_type & CS_TYPE_VAR) && !strchr(args->s, '.'))
 	{
-	  err = nerr_raise(NERR_ASSERT, 
-	      "Invalid number of arguments in call to cs_arg_parse");
-	  break;
+    map = lookup_map (parse, args->s, &c);
+    if (map) {
+      if (map->last) {
+        result->n = 1;
+      } else if (map->type == CS_TYPE_VAR) {
+        if (hdf_obj_next(map->h) == NULL) {
+          result->n = 1;
 	}
-	*i = arg_eval_num(parse, &val);
-	break;
-      default:
-	break;
     }
-    fmt++;
-    args = args->next;
-    if (val.alloc) free(val.s);
   }
+  }
+  return STATUS_OK;
+}
+
+/* returns the absolute value (ie, positive) of a number */
+static NEOERR * _builtin_abs (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                              CSARG *result)
+{
+  int n1 = 0;
+
+  result->op_type = CS_TYPE_NUM;
+  result->n = 0;
+
+  n1 = arg_eval_num(parse, args);
+  result->n = abs(n1);
+
+  return STATUS_OK;
+}
+
+/* returns the larger or two integers */
+static NEOERR * _builtin_max (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                              CSARG *result)
+{
+  NEOERR *err;
+  long int n1 = 0;
+  long int n2 = 0;
+
+  result->op_type = CS_TYPE_NUM;
+  result->n = 0;
+
+  err = cs_arg_parse(parse, args, "ii", &n1, &n2);
   if (err) return nerr_pass(err);
+  result->n = (n1 > n2) ? n1 : n2;
+
   return STATUS_OK;
 }
 
-static NEOERR * cs_arg_parse(CSPARSE *parse, CSARG *args, char *fmt, ...)
+/* returns the smaller or two integers */
+static NEOERR * _builtin_min (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args,
+                              CSARG *result)
 {
   NEOERR *err;
-  va_list ap;
+  long int n1 = 0;
+  long int n2 = 0;
 
-  va_start(ap, fmt);
-  err = cs_arg_parsev(parse, args, fmt, ap);
-  va_end(ap);
-  return nerr_pass(err);
+  result->op_type = CS_TYPE_NUM;
+  result->n = 0;
+
+  err = cs_arg_parse(parse, args, "ii", &n1, &n2);
+  if (err) return nerr_pass(err);
+  result->n = (n1 < n2) ? n1 : n2;
+
+  return STATUS_OK;
 }
 
 static NEOERR * _builtin_str_slice (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result)
@@ -3359,9 +3485,9 @@
   NEOERR *err;
   char *s = NULL;
   char *slice;
-  int b = 0;
-  int e = 0;
-  int len;
+  long int b = 0;
+  long int e = 0;
+  size_t len;
 
   result->op_type = CS_TYPE_STRING;
   result->s = "";
@@ -3475,10 +3601,10 @@
 
 /* **** CS Initialize/Destroy ************************************ */
 NEOERR *cs_init (CSPARSE **parse, HDF *hdf) {
-  return nerr_pass(cs_init_internal(parse, hdf, TRUE));
+  return nerr_pass(cs_init_internal(parse, hdf, NULL));
 }
 
-static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, BOOL init_funcs)
+static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, CSPARSE *parent)
 {
   NEOERR *err = STATUS_OK;
   CSPARSE *my_parse;
@@ -3528,52 +3654,60 @@
     cs_destroy(&my_parse);
     return nerr_pass(err);
   }
-  if (init_funcs)
-  {
-    err = _register_function(my_parse, "len", 1, _builtin_subcount);
-    if (err)
-    {
-      cs_destroy(&my_parse);
-      return nerr_pass(err);
-    }
-    err = _register_function(my_parse, "subcount", 1, _builtin_subcount);
-    if (err)
-    {
-      cs_destroy(&my_parse);
-      return nerr_pass(err);
-    }
-    err = _register_function(my_parse, "name", 1, _builtin_name);
-    if (err)
+  my_parse->tag = hdf_get_value(hdf, "Config.TagStart", "cs");
+  my_parse->taglen = strlen(my_parse->tag);
+  my_parse->hdf = hdf;
+
+  if (parent == NULL)
     {
-      cs_destroy(&my_parse);
-      return nerr_pass(err);
-    }
-    err = _register_function(my_parse, "string.slice", 3, _builtin_str_slice);
+    static struct _builtin_functions {
+      const char *name;
+      int nargs;
+      CSFUNCTION function;
+    } Builtins[] = {
+      { "len", 1, _builtin_subcount },
+      { "subcount", 1, _builtin_subcount },
+      { "name", 1, _builtin_name },
+      { "first", 1, _builtin_first },
+      { "last", 1, _builtin_last },
+      { "abs", 1, _builtin_abs },
+      { "max", 2, _builtin_max },
+      { "min", 2, _builtin_min },
+      { "string.slice", 3, _builtin_str_slice },
+      { "string.length", 1, _builtin_str_length },
+#ifdef ENABLE_GETTEXT
+      { "_", 1, _builtin_gettext },
+#endif
+      { NULL, 0, NULL },
+    };
+    int x = 0;
+    while (Builtins[x].name != NULL) {
+      err = _register_function(my_parse, Builtins[x].name, Builtins[x].nargs,
+                               Builtins[x].function);
     if (err)
     {
       cs_destroy(&my_parse);
       return nerr_pass(err);
     }
-    err = _register_function(my_parse, "string.length", 1, _builtin_str_length);
-    if (err)
-    {
-      cs_destroy(&my_parse);
-      return nerr_pass(err);
+      x++;
     }
-
-
+    /* Set global_hdf to be null */
+    my_parse->global_hdf = NULL;
+    my_parse->parent = NULL;
   }
-#ifdef ENABLE_GETTEXT
-  err = _register_function(my_parse, "_", 1, _builtin_gettext);
-  if (err)
+  else
   {
-    cs_destroy(&my_parse);
-    return nerr_pass(err);
+    /* TODO: macros and functions should actually not be duplicated, they
+     * should just be modified in lookup to walk the CS struct hierarchy we're 
+     * creating here */
+    /* BUG: We currently can't copy the macros because they reference the parse
+     * tree, so if this sub-parse tree adds a macro, the macro reference will
+     * persist, but the parse tree it points to will be gone when the sub-parse
+     * is gone. */
+    my_parse->functions = parent->functions;
+    my_parse->global_hdf = parent->global_hdf;
+    my_parse->parent = parent;
   }
-#endif
-  my_parse->tag = hdf_get_value(hdf, "Config.TagStart", "cs");
-  my_parse->taglen = strlen(my_parse->tag);
-  my_parse->hdf = hdf;
 
   *parse = my_parse;
   return STATUS_OK;
@@ -3591,7 +3725,9 @@
 
   dealloc_macro(&my_parse->macros);
   dealloc_node(&(my_parse->tree));
+  if (my_parse->parent == NULL) {
   dealloc_function(&(my_parse->functions));
+  }
 
   free(my_parse);
   *parse = NULL;
@@ -3806,4 +3942,3 @@
   return nerr_pass (err);
 }
 #endif
-
diff -Nrub clearsilver-0.10.1/cs/Makefile clearsilver-0.10.2/cs/Makefile
--- clearsilver-0.10.1/cs/Makefile	2005-06-30 11:51:49.000000000 -0700
+++ clearsilver-0.10.2/cs/Makefile	2005-12-02 02:34:47.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 CS_LIB = $(LIB_DIR)libneo_cs.a
 CS_SRC = csparse.c
@@ -22,7 +22,6 @@
 CSDUMP_SRC = csdump.c
 CSDUMP_OBJ = $(CSDUMP_SRC:%.c=%.o)
 
-CFLAGS += -I$(NEOTONIC_ROOT)
 LIBS += -L$(LIB_DIR) -lneo_cs -lneo_utl # -lefence
 
 TARGETS = $(CS_LIB) $(CSTEST_EXE) $(CSR_EXE) test
@@ -32,7 +31,7 @@
 	   test14.cs test15.cs test16.cs test17.cs test18.cs test_var.cs \
 	   test_paren.cs test_chuck.cs test_trak1.cs test_iter.cs \
 	   test_each_array.cs test_name.cs test_with.cs test_numbers.cs \
-	   test_splice.cs test_joo.cs
+	   test_splice.cs test_joo.cs test_first_last.cs test_abs_max_min.cs
 
 all: $(TARGETS)
 
@@ -64,7 +63,7 @@
 	for test in $(CS_TESTS); do \
 		rm -f $$test.out; \
 		./cstest test.hdf $$test > $$test.out 2>&1; \
-		diff --brief $$test.out $$test.gold 2>&1 > /dev/null; \
+		diff $$test.out $$test.gold 2>&1 > /dev/null; \
 		return_code=$$?; \
 		if [ $$return_code -ne 0 ]; then \
 		  diff $$test.gold $$test.out > $$test.err; \
@@ -75,7 +74,7 @@
 	done; \
 	rm -f test_tag.cs.out; \
 	./cstest test_tag.hdf test_tag.cs> test_tag.cs.out 2>&1; \
-	diff --brief test_tag.cs.out test_tag.cs.gold; \
+	diff test_tag.cs.out test_tag.cs.gold; \
 	return_code=$$?; \
 	if [ $$return_code -ne 0 ]; then \
 	  echo "Failed Regression Test: test_tag.cs"; \
@@ -88,7 +87,7 @@
 	@echo "Passed"
 	
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(cs_includedir)/cs
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cs
 	$(INSTALL) -m 644 cs.h $(DESTDIR)$(cs_includedir)/cs
 	$(INSTALL) -m 644 $(CS_LIB) $(DESTDIR)$(libdir)
 	$(INSTALL) $(CSTEST_EXE) $(DESTDIR)$(bindir)
diff -Nrub clearsilver-0.10.1/cs/test_abs_max_min.cs clearsilver-0.10.2/cs/test_abs_max_min.cs
--- clearsilver-0.10.1/cs/test_abs_max_min.cs	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/cs/test_abs_max_min.cs	2005-09-01 12:09:48.000000000 -0700
@@ -0,0 +1,28 @@
+
+abs(-10) = <?cs var:abs(-10) ?>
+abs("-10") = <?cs var:abs("-10") ?>
+abs("10") = <?cs var:abs("10") ?>
+abs("0") = <?cs var:abs("0") ?>
+
+<?cs loop:x = -5, 5, 1 ?>
+  abs(<?cs var:x ?>) = <?cs var:abs(x) ?>
+<?cs /loop ?>
+
+min(5,10) = <?cs var:min(5, 10) ?>
+min(-5,10) = <?cs var:min(-5, 10) ?>
+min(-5,-10) = <?cs var:min(-5, -10) ?>
+min(5,-10) = <?cs var:min(5, -10) ?>
+
+max(5,10) = <?cs var:max(5, 10) ?>
+max(-5,10) = <?cs var:max(-5, 10) ?>
+max(-5,-10) = <?cs var:max(-5, -10) ?>
+max(5,-10) = <?cs var:max(5, -10) ?>
+
+<?cs loop:x = -10, 10, 1 ?>
+  <?cs loop:y = -10, 10, 2 ?>
+    max(<?cs var:x ?>, <?cs var:y ?>) = <?cs var:max(x,y) ?>
+    max(<?cs var:y ?>, <?cs var:x ?>) = <?cs var:max(y,x) ?>
+    min(<?cs var:x ?>, <?cs var:y ?>) = <?cs var:min(x,y) ?>
+    min(<?cs var:y ?>, <?cs var:x ?>) = <?cs var:min(y,x) ?>
+  <?cs /loop ?>
+<?cs /loop ?>
diff -Nrub clearsilver-0.10.1/cs/test_abs_max_min.cs.gold clearsilver-0.10.2/cs/test_abs_max_min.cs.gold
--- clearsilver-0.10.1/cs/test_abs_max_min.cs.gold	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/cs/test_abs_max_min.cs.gold	2005-09-07 14:57:26.000000000 -0700
@@ -0,0 +1,1239 @@
+Parsing test_abs_max_min.cs
+
+abs(-10) = 10
+abs("-10") = 10
+abs("10") = 10
+abs("0") = 0
+
+
+  abs(-5) = 5
+
+  abs(-4) = 4
+
+  abs(-3) = 3
+
+  abs(-2) = 2
+
+  abs(-1) = 1
+
+  abs(0) = 0
+
+  abs(1) = 1
+
+  abs(2) = 2
+
+  abs(3) = 3
+
+  abs(4) = 4
+
+  abs(5) = 5
+
+
+min(5,10) = 5
+min(-5,10) = -5
+min(-5,-10) = -10
+min(5,-10) = -10
+
+max(5,10) = 10
+max(-5,10) = 10
+max(-5,-10) = -5
+max(5,-10) = 5
+
+
+  
+    max(-10, -10) = -10
+    max(-10, -10) = -10
+    min(-10, -10) = -10
+    min(-10, -10) = -10
+  
+    max(-10, -8) = -8
+    max(-8, -10) = -8
+    min(-10, -8) = -10
+    min(-8, -10) = -10
+  
+    max(-10, -6) = -6
+    max(-6, -10) = -6
+    min(-10, -6) = -10
+    min(-6, -10) = -10
+  
+    max(-10, -4) = -4
+    max(-4, -10) = -4
+    min(-10, -4) = -10
+    min(-4, -10) = -10
+  
+    max(-10, -2) = -2
+    max(-2, -10) = -2
+    min(-10, -2) = -10
+    min(-2, -10) = -10
+  
+    max(-10, 0) = 0
+    max(0, -10) = 0
+    min(-10, 0) = -10
+    min(0, -10) = -10
+  
+    max(-10, 2) = 2
+    max(2, -10) = 2
+    min(-10, 2) = -10
+    min(2, -10) = -10
+  
+    max(-10, 4) = 4
+    max(4, -10) = 4
+    min(-10, 4) = -10
+    min(4, -10) = -10
+  
+    max(-10, 6) = 6
+    max(6, -10) = 6
+    min(-10, 6) = -10
+    min(6, -10) = -10
+  
+    max(-10, 8) = 8
+    max(8, -10) = 8
+    min(-10, 8) = -10
+    min(8, -10) = -10
+  
+    max(-10, 10) = 10
+    max(10, -10) = 10
+    min(-10, 10) = -10
+    min(10, -10) = -10
+  
+
+  
+    max(-9, -10) = -9
+    max(-10, -9) = -9
+    min(-9, -10) = -10
+    min(-10, -9) = -10
+  
+    max(-9, -8) = -8
+    max(-8, -9) = -8
+    min(-9, -8) = -9
+    min(-8, -9) = -9
+  
+    max(-9, -6) = -6
+    max(-6, -9) = -6
+    min(-9, -6) = -9
+    min(-6, -9) = -9
+  
+    max(-9, -4) = -4
+    max(-4, -9) = -4
+    min(-9, -4) = -9
+    min(-4, -9) = -9
+  
+    max(-9, -2) = -2
+    max(-2, -9) = -2
+    min(-9, -2) = -9
+    min(-2, -9) = -9
+  
+    max(-9, 0) = 0
+    max(0, -9) = 0
+    min(-9, 0) = -9
+    min(0, -9) = -9
+  
+    max(-9, 2) = 2
+    max(2, -9) = 2
+    min(-9, 2) = -9
+    min(2, -9) = -9
+  
+    max(-9, 4) = 4
+    max(4, -9) = 4
+    min(-9, 4) = -9
+    min(4, -9) = -9
+  
+    max(-9, 6) = 6
+    max(6, -9) = 6
+    min(-9, 6) = -9
+    min(6, -9) = -9
+  
+    max(-9, 8) = 8
+    max(8, -9) = 8
+    min(-9, 8) = -9
+    min(8, -9) = -9
+  
+    max(-9, 10) = 10
+    max(10, -9) = 10
+    min(-9, 10) = -9
+    min(10, -9) = -9
+  
+
+  
+    max(-8, -10) = -8
+    max(-10, -8) = -8
+    min(-8, -10) = -10
+    min(-10, -8) = -10
+  
+    max(-8, -8) = -8
+    max(-8, -8) = -8
+    min(-8, -8) = -8
+    min(-8, -8) = -8
+  
+    max(-8, -6) = -6
+    max(-6, -8) = -6
+    min(-8, -6) = -8
+    min(-6, -8) = -8
+  
+    max(-8, -4) = -4
+    max(-4, -8) = -4
+    min(-8, -4) = -8
+    min(-4, -8) = -8
+  
+    max(-8, -2) = -2
+    max(-2, -8) = -2
+    min(-8, -2) = -8
+    min(-2, -8) = -8
+  
+    max(-8, 0) = 0
+    max(0, -8) = 0
+    min(-8, 0) = -8
+    min(0, -8) = -8
+  
+    max(-8, 2) = 2
+    max(2, -8) = 2
+    min(-8, 2) = -8
+    min(2, -8) = -8
+  
+    max(-8, 4) = 4
+    max(4, -8) = 4
+    min(-8, 4) = -8
+    min(4, -8) = -8
+  
+    max(-8, 6) = 6
+    max(6, -8) = 6
+    min(-8, 6) = -8
+    min(6, -8) = -8
+  
+    max(-8, 8) = 8
+    max(8, -8) = 8
+    min(-8, 8) = -8
+    min(8, -8) = -8
+  
+    max(-8, 10) = 10
+    max(10, -8) = 10
+    min(-8, 10) = -8
+    min(10, -8) = -8
+  
+
+  
+    max(-7, -10) = -7
+    max(-10, -7) = -7
+    min(-7, -10) = -10
+    min(-10, -7) = -10
+  
+    max(-7, -8) = -7
+    max(-8, -7) = -7
+    min(-7, -8) = -8
+    min(-8, -7) = -8
+  
+    max(-7, -6) = -6
+    max(-6, -7) = -6
+    min(-7, -6) = -7
+    min(-6, -7) = -7
+  
+    max(-7, -4) = -4
+    max(-4, -7) = -4
+    min(-7, -4) = -7
+    min(-4, -7) = -7
+  
+    max(-7, -2) = -2
+    max(-2, -7) = -2
+    min(-7, -2) = -7
+    min(-2, -7) = -7
+  
+    max(-7, 0) = 0
+    max(0, -7) = 0
+    min(-7, 0) = -7
+    min(0, -7) = -7
+  
+    max(-7, 2) = 2
+    max(2, -7) = 2
+    min(-7, 2) = -7
+    min(2, -7) = -7
+  
+    max(-7, 4) = 4
+    max(4, -7) = 4
+    min(-7, 4) = -7
+    min(4, -7) = -7
+  
+    max(-7, 6) = 6
+    max(6, -7) = 6
+    min(-7, 6) = -7
+    min(6, -7) = -7
+  
+    max(-7, 8) = 8
+    max(8, -7) = 8
+    min(-7, 8) = -7
+    min(8, -7) = -7
+  
+    max(-7, 10) = 10
+    max(10, -7) = 10
+    min(-7, 10) = -7
+    min(10, -7) = -7
+  
+
+  
+    max(-6, -10) = -6
+    max(-10, -6) = -6
+    min(-6, -10) = -10
+    min(-10, -6) = -10
+  
+    max(-6, -8) = -6
+    max(-8, -6) = -6
+    min(-6, -8) = -8
+    min(-8, -6) = -8
+  
+    max(-6, -6) = -6
+    max(-6, -6) = -6
+    min(-6, -6) = -6
+    min(-6, -6) = -6
+  
+    max(-6, -4) = -4
+    max(-4, -6) = -4
+    min(-6, -4) = -6
+    min(-4, -6) = -6
+  
+    max(-6, -2) = -2
+    max(-2, -6) = -2
+    min(-6, -2) = -6
+    min(-2, -6) = -6
+  
+    max(-6, 0) = 0
+    max(0, -6) = 0
+    min(-6, 0) = -6
+    min(0, -6) = -6
+  
+    max(-6, 2) = 2
+    max(2, -6) = 2
+    min(-6, 2) = -6
+    min(2, -6) = -6
+  
+    max(-6, 4) = 4
+    max(4, -6) = 4
+    min(-6, 4) = -6
+    min(4, -6) = -6
+  
+    max(-6, 6) = 6
+    max(6, -6) = 6
+    min(-6, 6) = -6
+    min(6, -6) = -6
+  
+    max(-6, 8) = 8
+    max(8, -6) = 8
+    min(-6, 8) = -6
+    min(8, -6) = -6
+  
+    max(-6, 10) = 10
+    max(10, -6) = 10
+    min(-6, 10) = -6
+    min(10, -6) = -6
+  
+
+  
+    max(-5, -10) = -5
+    max(-10, -5) = -5
+    min(-5, -10) = -10
+    min(-10, -5) = -10
+  
+    max(-5, -8) = -5
+    max(-8, -5) = -5
+    min(-5, -8) = -8
+    min(-8, -5) = -8
+  
+    max(-5, -6) = -5
+    max(-6, -5) = -5
+    min(-5, -6) = -6
+    min(-6, -5) = -6
+  
+    max(-5, -4) = -4
+    max(-4, -5) = -4
+    min(-5, -4) = -5
+    min(-4, -5) = -5
+  
+    max(-5, -2) = -2
+    max(-2, -5) = -2
+    min(-5, -2) = -5
+    min(-2, -5) = -5
+  
+    max(-5, 0) = 0
+    max(0, -5) = 0
+    min(-5, 0) = -5
+    min(0, -5) = -5
+  
+    max(-5, 2) = 2
+    max(2, -5) = 2
+    min(-5, 2) = -5
+    min(2, -5) = -5
+  
+    max(-5, 4) = 4
+    max(4, -5) = 4
+    min(-5, 4) = -5
+    min(4, -5) = -5
+  
+    max(-5, 6) = 6
+    max(6, -5) = 6
+    min(-5, 6) = -5
+    min(6, -5) = -5
+  
+    max(-5, 8) = 8
+    max(8, -5) = 8
+    min(-5, 8) = -5
+    min(8, -5) = -5
+  
+    max(-5, 10) = 10
+    max(10, -5) = 10
+    min(-5, 10) = -5
+    min(10, -5) = -5
+  
+
+  
+    max(-4, -10) = -4
+    max(-10, -4) = -4
+    min(-4, -10) = -10
+    min(-10, -4) = -10
+  
+    max(-4, -8) = -4
+    max(-8, -4) = -4
+    min(-4, -8) = -8
+    min(-8, -4) = -8
+  
+    max(-4, -6) = -4
+    max(-6, -4) = -4
+    min(-4, -6) = -6
+    min(-6, -4) = -6
+  
+    max(-4, -4) = -4
+    max(-4, -4) = -4
+    min(-4, -4) = -4
+    min(-4, -4) = -4
+  
+    max(-4, -2) = -2
+    max(-2, -4) = -2
+    min(-4, -2) = -4
+    min(-2, -4) = -4
+  
+    max(-4, 0) = 0
+    max(0, -4) = 0
+    min(-4, 0) = -4
+    min(0, -4) = -4
+  
+    max(-4, 2) = 2
+    max(2, -4) = 2
+    min(-4, 2) = -4
+    min(2, -4) = -4
+  
+    max(-4, 4) = 4
+    max(4, -4) = 4
+    min(-4, 4) = -4
+    min(4, -4) = -4
+  
+    max(-4, 6) = 6
+    max(6, -4) = 6
+    min(-4, 6) = -4
+    min(6, -4) = -4
+  
+    max(-4, 8) = 8
+    max(8, -4) = 8
+    min(-4, 8) = -4
+    min(8, -4) = -4
+  
+    max(-4, 10) = 10
+    max(10, -4) = 10
+    min(-4, 10) = -4
+    min(10, -4) = -4
+  
+
+  
+    max(-3, -10) = -3
+    max(-10, -3) = -3
+    min(-3, -10) = -10
+    min(-10, -3) = -10
+  
+    max(-3, -8) = -3
+    max(-8, -3) = -3
+    min(-3, -8) = -8
+    min(-8, -3) = -8
+  
+    max(-3, -6) = -3
+    max(-6, -3) = -3
+    min(-3, -6) = -6
+    min(-6, -3) = -6
+  
+    max(-3, -4) = -3
+    max(-4, -3) = -3
+    min(-3, -4) = -4
+    min(-4, -3) = -4
+  
+    max(-3, -2) = -2
+    max(-2, -3) = -2
+    min(-3, -2) = -3
+    min(-2, -3) = -3
+  
+    max(-3, 0) = 0
+    max(0, -3) = 0
+    min(-3, 0) = -3
+    min(0, -3) = -3
+  
+    max(-3, 2) = 2
+    max(2, -3) = 2
+    min(-3, 2) = -3
+    min(2, -3) = -3
+  
+    max(-3, 4) = 4
+    max(4, -3) = 4
+    min(-3, 4) = -3
+    min(4, -3) = -3
+  
+    max(-3, 6) = 6
+    max(6, -3) = 6
+    min(-3, 6) = -3
+    min(6, -3) = -3
+  
+    max(-3, 8) = 8
+    max(8, -3) = 8
+    min(-3, 8) = -3
+    min(8, -3) = -3
+  
+    max(-3, 10) = 10
+    max(10, -3) = 10
+    min(-3, 10) = -3
+    min(10, -3) = -3
+  
+
+  
+    max(-2, -10) = -2
+    max(-10, -2) = -2
+    min(-2, -10) = -10
+    min(-10, -2) = -10
+  
+    max(-2, -8) = -2
+    max(-8, -2) = -2
+    min(-2, -8) = -8
+    min(-8, -2) = -8
+  
+    max(-2, -6) = -2
+    max(-6, -2) = -2
+    min(-2, -6) = -6
+    min(-6, -2) = -6
+  
+    max(-2, -4) = -2
+    max(-4, -2) = -2
+    min(-2, -4) = -4
+    min(-4, -2) = -4
+  
+    max(-2, -2) = -2
+    max(-2, -2) = -2
+    min(-2, -2) = -2
+    min(-2, -2) = -2
+  
+    max(-2, 0) = 0
+    max(0, -2) = 0
+    min(-2, 0) = -2
+    min(0, -2) = -2
+  
+    max(-2, 2) = 2
+    max(2, -2) = 2
+    min(-2, 2) = -2
+    min(2, -2) = -2
+  
+    max(-2, 4) = 4
+    max(4, -2) = 4
+    min(-2, 4) = -2
+    min(4, -2) = -2
+  
+    max(-2, 6) = 6
+    max(6, -2) = 6
+    min(-2, 6) = -2
+    min(6, -2) = -2
+  
+    max(-2, 8) = 8
+    max(8, -2) = 8
+    min(-2, 8) = -2
+    min(8, -2) = -2
+  
+    max(-2, 10) = 10
+    max(10, -2) = 10
+    min(-2, 10) = -2
+    min(10, -2) = -2
+  
+
+  
+    max(-1, -10) = -1
+    max(-10, -1) = -1
+    min(-1, -10) = -10
+    min(-10, -1) = -10
+  
+    max(-1, -8) = -1
+    max(-8, -1) = -1
+    min(-1, -8) = -8
+    min(-8, -1) = -8
+  
+    max(-1, -6) = -1
+    max(-6, -1) = -1
+    min(-1, -6) = -6
+    min(-6, -1) = -6
+  
+    max(-1, -4) = -1
+    max(-4, -1) = -1
+    min(-1, -4) = -4
+    min(-4, -1) = -4
+  
+    max(-1, -2) = -1
+    max(-2, -1) = -1
+    min(-1, -2) = -2
+    min(-2, -1) = -2
+  
+    max(-1, 0) = 0
+    max(0, -1) = 0
+    min(-1, 0) = -1
+    min(0, -1) = -1
+  
+    max(-1, 2) = 2
+    max(2, -1) = 2
+    min(-1, 2) = -1
+    min(2, -1) = -1
+  
+    max(-1, 4) = 4
+    max(4, -1) = 4
+    min(-1, 4) = -1
+    min(4, -1) = -1
+  
+    max(-1, 6) = 6
+    max(6, -1) = 6
+    min(-1, 6) = -1
+    min(6, -1) = -1
+  
+    max(-1, 8) = 8
+    max(8, -1) = 8
+    min(-1, 8) = -1
+    min(8, -1) = -1
+  
+    max(-1, 10) = 10
+    max(10, -1) = 10
+    min(-1, 10) = -1
+    min(10, -1) = -1
+  
+
+  
+    max(0, -10) = 0
+    max(-10, 0) = 0
+    min(0, -10) = -10
+    min(-10, 0) = -10
+  
+    max(0, -8) = 0
+    max(-8, 0) = 0
+    min(0, -8) = -8
+    min(-8, 0) = -8
+  
+    max(0, -6) = 0
+    max(-6, 0) = 0
+    min(0, -6) = -6
+    min(-6, 0) = -6
+  
+    max(0, -4) = 0
+    max(-4, 0) = 0
+    min(0, -4) = -4
+    min(-4, 0) = -4
+  
+    max(0, -2) = 0
+    max(-2, 0) = 0
+    min(0, -2) = -2
+    min(-2, 0) = -2
+  
+    max(0, 0) = 0
+    max(0, 0) = 0
+    min(0, 0) = 0
+    min(0, 0) = 0
+  
+    max(0, 2) = 2
+    max(2, 0) = 2
+    min(0, 2) = 0
+    min(2, 0) = 0
+  
+    max(0, 4) = 4
+    max(4, 0) = 4
+    min(0, 4) = 0
+    min(4, 0) = 0
+  
+    max(0, 6) = 6
+    max(6, 0) = 6
+    min(0, 6) = 0
+    min(6, 0) = 0
+  
+    max(0, 8) = 8
+    max(8, 0) = 8
+    min(0, 8) = 0
+    min(8, 0) = 0
+  
+    max(0, 10) = 10
+    max(10, 0) = 10
+    min(0, 10) = 0
+    min(10, 0) = 0
+  
+
+  
+    max(1, -10) = 1
+    max(-10, 1) = 1
+    min(1, -10) = -10
+    min(-10, 1) = -10
+  
+    max(1, -8) = 1
+    max(-8, 1) = 1
+    min(1, -8) = -8
+    min(-8, 1) = -8
+  
+    max(1, -6) = 1
+    max(-6, 1) = 1
+    min(1, -6) = -6
+    min(-6, 1) = -6
+  
+    max(1, -4) = 1
+    max(-4, 1) = 1
+    min(1, -4) = -4
+    min(-4, 1) = -4
+  
+    max(1, -2) = 1
+    max(-2, 1) = 1
+    min(1, -2) = -2
+    min(-2, 1) = -2
+  
+    max(1, 0) = 1
+    max(0, 1) = 1
+    min(1, 0) = 0
+    min(0, 1) = 0
+  
+    max(1, 2) = 2
+    max(2, 1) = 2
+    min(1, 2) = 1
+    min(2, 1) = 1
+  
+    max(1, 4) = 4
+    max(4, 1) = 4
+    min(1, 4) = 1
+    min(4, 1) = 1
+  
+    max(1, 6) = 6
+    max(6, 1) = 6
+    min(1, 6) = 1
+    min(6, 1) = 1
+  
+    max(1, 8) = 8
+    max(8, 1) = 8
+    min(1, 8) = 1
+    min(8, 1) = 1
+  
+    max(1, 10) = 10
+    max(10, 1) = 10
+    min(1, 10) = 1
+    min(10, 1) = 1
+  
+
+  
+    max(2, -10) = 2
+    max(-10, 2) = 2
+    min(2, -10) = -10
+    min(-10, 2) = -10
+  
+    max(2, -8) = 2
+    max(-8, 2) = 2
+    min(2, -8) = -8
+    min(-8, 2) = -8
+  
+    max(2, -6) = 2
+    max(-6, 2) = 2
+    min(2, -6) = -6
+    min(-6, 2) = -6
+  
+    max(2, -4) = 2
+    max(-4, 2) = 2
+    min(2, -4) = -4
+    min(-4, 2) = -4
+  
+    max(2, -2) = 2
+    max(-2, 2) = 2
+    min(2, -2) = -2
+    min(-2, 2) = -2
+  
+    max(2, 0) = 2
+    max(0, 2) = 2
+    min(2, 0) = 0
+    min(0, 2) = 0
+  
+    max(2, 2) = 2
+    max(2, 2) = 2
+    min(2, 2) = 2
+    min(2, 2) = 2
+  
+    max(2, 4) = 4
+    max(4, 2) = 4
+    min(2, 4) = 2
+    min(4, 2) = 2
+  
+    max(2, 6) = 6
+    max(6, 2) = 6
+    min(2, 6) = 2
+    min(6, 2) = 2
+  
+    max(2, 8) = 8
+    max(8, 2) = 8
+    min(2, 8) = 2
+    min(8, 2) = 2
+  
+    max(2, 10) = 10
+    max(10, 2) = 10
+    min(2, 10) = 2
+    min(10, 2) = 2
+  
+
+  
+    max(3, -10) = 3
+    max(-10, 3) = 3
+    min(3, -10) = -10
+    min(-10, 3) = -10
+  
+    max(3, -8) = 3
+    max(-8, 3) = 3
+    min(3, -8) = -8
+    min(-8, 3) = -8
+  
+    max(3, -6) = 3
+    max(-6, 3) = 3
+    min(3, -6) = -6
+    min(-6, 3) = -6
+  
+    max(3, -4) = 3
+    max(-4, 3) = 3
+    min(3, -4) = -4
+    min(-4, 3) = -4
+  
+    max(3, -2) = 3
+    max(-2, 3) = 3
+    min(3, -2) = -2
+    min(-2, 3) = -2
+  
+    max(3, 0) = 3
+    max(0, 3) = 3
+    min(3, 0) = 0
+    min(0, 3) = 0
+  
+    max(3, 2) = 3
+    max(2, 3) = 3
+    min(3, 2) = 2
+    min(2, 3) = 2
+  
+    max(3, 4) = 4
+    max(4, 3) = 4
+    min(3, 4) = 3
+    min(4, 3) = 3
+  
+    max(3, 6) = 6
+    max(6, 3) = 6
+    min(3, 6) = 3
+    min(6, 3) = 3
+  
+    max(3, 8) = 8
+    max(8, 3) = 8
+    min(3, 8) = 3
+    min(8, 3) = 3
+  
+    max(3, 10) = 10
+    max(10, 3) = 10
+    min(3, 10) = 3
+    min(10, 3) = 3
+  
+
+  
+    max(4, -10) = 4
+    max(-10, 4) = 4
+    min(4, -10) = -10
+    min(-10, 4) = -10
+  
+    max(4, -8) = 4
+    max(-8, 4) = 4
+    min(4, -8) = -8
+    min(-8, 4) = -8
+  
+    max(4, -6) = 4
+    max(-6, 4) = 4
+    min(4, -6) = -6
+    min(-6, 4) = -6
+  
+    max(4, -4) = 4
+    max(-4, 4) = 4
+    min(4, -4) = -4
+    min(-4, 4) = -4
+  
+    max(4, -2) = 4
+    max(-2, 4) = 4
+    min(4, -2) = -2
+    min(-2, 4) = -2
+  
+    max(4, 0) = 4
+    max(0, 4) = 4
+    min(4, 0) = 0
+    min(0, 4) = 0
+  
+    max(4, 2) = 4
+    max(2, 4) = 4
+    min(4, 2) = 2
+    min(2, 4) = 2
+  
+    max(4, 4) = 4
+    max(4, 4) = 4
+    min(4, 4) = 4
+    min(4, 4) = 4
+  
+    max(4, 6) = 6
+    max(6, 4) = 6
+    min(4, 6) = 4
+    min(6, 4) = 4
+  
+    max(4, 8) = 8
+    max(8, 4) = 8
+    min(4, 8) = 4
+    min(8, 4) = 4
+  
+    max(4, 10) = 10
+    max(10, 4) = 10
+    min(4, 10) = 4
+    min(10, 4) = 4
+  
+
+  
+    max(5, -10) = 5
+    max(-10, 5) = 5
+    min(5, -10) = -10
+    min(-10, 5) = -10
+  
+    max(5, -8) = 5
+    max(-8, 5) = 5
+    min(5, -8) = -8
+    min(-8, 5) = -8
+  
+    max(5, -6) = 5
+    max(-6, 5) = 5
+    min(5, -6) = -6
+    min(-6, 5) = -6
+  
+    max(5, -4) = 5
+    max(-4, 5) = 5
+    min(5, -4) = -4
+    min(-4, 5) = -4
+  
+    max(5, -2) = 5
+    max(-2, 5) = 5
+    min(5, -2) = -2
+    min(-2, 5) = -2
+  
+    max(5, 0) = 5
+    max(0, 5) = 5
+    min(5, 0) = 0
+    min(0, 5) = 0
+  
+    max(5, 2) = 5
+    max(2, 5) = 5
+    min(5, 2) = 2
+    min(2, 5) = 2
+  
+    max(5, 4) = 5
+    max(4, 5) = 5
+    min(5, 4) = 4
+    min(4, 5) = 4
+  
+    max(5, 6) = 6
+    max(6, 5) = 6
+    min(5, 6) = 5
+    min(6, 5) = 5
+  
+    max(5, 8) = 8
+    max(8, 5) = 8
+    min(5, 8) = 5
+    min(8, 5) = 5
+  
+    max(5, 10) = 10
+    max(10, 5) = 10
+    min(5, 10) = 5
+    min(10, 5) = 5
+  
+
+  
+    max(6, -10) = 6
+    max(-10, 6) = 6
+    min(6, -10) = -10
+    min(-10, 6) = -10
+  
+    max(6, -8) = 6
+    max(-8, 6) = 6
+    min(6, -8) = -8
+    min(-8, 6) = -8
+  
+    max(6, -6) = 6
+    max(-6, 6) = 6
+    min(6, -6) = -6
+    min(-6, 6) = -6
+  
+    max(6, -4) = 6
+    max(-4, 6) = 6
+    min(6, -4) = -4
+    min(-4, 6) = -4
+  
+    max(6, -2) = 6
+    max(-2, 6) = 6
+    min(6, -2) = -2
+    min(-2, 6) = -2
+  
+    max(6, 0) = 6
+    max(0, 6) = 6
+    min(6, 0) = 0
+    min(0, 6) = 0
+  
+    max(6, 2) = 6
+    max(2, 6) = 6
+    min(6, 2) = 2
+    min(2, 6) = 2
+  
+    max(6, 4) = 6
+    max(4, 6) = 6
+    min(6, 4) = 4
+    min(4, 6) = 4
+  
+    max(6, 6) = 6
+    max(6, 6) = 6
+    min(6, 6) = 6
+    min(6, 6) = 6
+  
+    max(6, 8) = 8
+    max(8, 6) = 8
+    min(6, 8) = 6
+    min(8, 6) = 6
+  
+    max(6, 10) = 10
+    max(10, 6) = 10
+    min(6, 10) = 6
+    min(10, 6) = 6
+  
+
+  
+    max(7, -10) = 7
+    max(-10, 7) = 7
+    min(7, -10) = -10
+    min(-10, 7) = -10
+  
+    max(7, -8) = 7
+    max(-8, 7) = 7
+    min(7, -8) = -8
+    min(-8, 7) = -8
+  
+    max(7, -6) = 7
+    max(-6, 7) = 7
+    min(7, -6) = -6
+    min(-6, 7) = -6
+  
+    max(7, -4) = 7
+    max(-4, 7) = 7
+    min(7, -4) = -4
+    min(-4, 7) = -4
+  
+    max(7, -2) = 7
+    max(-2, 7) = 7
+    min(7, -2) = -2
+    min(-2, 7) = -2
+  
+    max(7, 0) = 7
+    max(0, 7) = 7
+    min(7, 0) = 0
+    min(0, 7) = 0
+  
+    max(7, 2) = 7
+    max(2, 7) = 7
+    min(7, 2) = 2
+    min(2, 7) = 2
+  
+    max(7, 4) = 7
+    max(4, 7) = 7
+    min(7, 4) = 4
+    min(4, 7) = 4
+  
+    max(7, 6) = 7
+    max(6, 7) = 7
+    min(7, 6) = 6
+    min(6, 7) = 6
+  
+    max(7, 8) = 8
+    max(8, 7) = 8
+    min(7, 8) = 7
+    min(8, 7) = 7
+  
+    max(7, 10) = 10
+    max(10, 7) = 10
+    min(7, 10) = 7
+    min(10, 7) = 7
+  
+
+  
+    max(8, -10) = 8
+    max(-10, 8) = 8
+    min(8, -10) = -10
+    min(-10, 8) = -10
+  
+    max(8, -8) = 8
+    max(-8, 8) = 8
+    min(8, -8) = -8
+    min(-8, 8) = -8
+  
+    max(8, -6) = 8
+    max(-6, 8) = 8
+    min(8, -6) = -6
+    min(-6, 8) = -6
+  
+    max(8, -4) = 8
+    max(-4, 8) = 8
+    min(8, -4) = -4
+    min(-4, 8) = -4
+  
+    max(8, -2) = 8
+    max(-2, 8) = 8
+    min(8, -2) = -2
+    min(-2, 8) = -2
+  
+    max(8, 0) = 8
+    max(0, 8) = 8
+    min(8, 0) = 0
+    min(0, 8) = 0
+  
+    max(8, 2) = 8
+    max(2, 8) = 8
+    min(8, 2) = 2
+    min(2, 8) = 2
+  
+    max(8, 4) = 8
+    max(4, 8) = 8
+    min(8, 4) = 4
+    min(4, 8) = 4
+  
+    max(8, 6) = 8
+    max(6, 8) = 8
+    min(8, 6) = 6
+    min(6, 8) = 6
+  
+    max(8, 8) = 8
+    max(8, 8) = 8
+    min(8, 8) = 8
+    min(8, 8) = 8
+  
+    max(8, 10) = 10
+    max(10, 8) = 10
+    min(8, 10) = 8
+    min(10, 8) = 8
+  
+
+  
+    max(9, -10) = 9
+    max(-10, 9) = 9
+    min(9, -10) = -10
+    min(-10, 9) = -10
+  
+    max(9, -8) = 9
+    max(-8, 9) = 9
+    min(9, -8) = -8
+    min(-8, 9) = -8
+  
+    max(9, -6) = 9
+    max(-6, 9) = 9
+    min(9, -6) = -6
+    min(-6, 9) = -6
+  
+    max(9, -4) = 9
+    max(-4, 9) = 9
+    min(9, -4) = -4
+    min(-4, 9) = -4
+  
+    max(9, -2) = 9
+    max(-2, 9) = 9
+    min(9, -2) = -2
+    min(-2, 9) = -2
+  
+    max(9, 0) = 9
+    max(0, 9) = 9
+    min(9, 0) = 0
+    min(0, 9) = 0
+  
+    max(9, 2) = 9
+    max(2, 9) = 9
+    min(9, 2) = 2
+    min(2, 9) = 2
+  
+    max(9, 4) = 9
+    max(4, 9) = 9
+    min(9, 4) = 4
+    min(4, 9) = 4
+  
+    max(9, 6) = 9
+    max(6, 9) = 9
+    min(9, 6) = 6
+    min(6, 9) = 6
+  
+    max(9, 8) = 9
+    max(8, 9) = 9
+    min(9, 8) = 8
+    min(8, 9) = 8
+  
+    max(9, 10) = 10
+    max(10, 9) = 10
+    min(9, 10) = 9
+    min(10, 9) = 9
+  
+
+  
+    max(10, -10) = 10
+    max(-10, 10) = 10
+    min(10, -10) = -10
+    min(-10, 10) = -10
+  
+    max(10, -8) = 10
+    max(-8, 10) = 10
+    min(10, -8) = -8
+    min(-8, 10) = -8
+  
+    max(10, -6) = 10
+    max(-6, 10) = 10
+    min(10, -6) = -6
+    min(-6, 10) = -6
+  
+    max(10, -4) = 10
+    max(-4, 10) = 10
+    min(10, -4) = -4
+    min(-4, 10) = -4
+  
+    max(10, -2) = 10
+    max(-2, 10) = 10
+    min(10, -2) = -2
+    min(-2, 10) = -2
+  
+    max(10, 0) = 10
+    max(0, 10) = 10
+    min(10, 0) = 0
+    min(0, 10) = 0
+  
+    max(10, 2) = 10
+    max(2, 10) = 10
+    min(10, 2) = 2
+    min(2, 10) = 2
+  
+    max(10, 4) = 10
+    max(4, 10) = 10
+    min(10, 4) = 4
+    min(4, 10) = 4
+  
+    max(10, 6) = 10
+    max(6, 10) = 10
+    min(10, 6) = 6
+    min(6, 10) = 6
+  
+    max(10, 8) = 10
+    max(8, 10) = 10
+    min(10, 8) = 8
+    min(8, 10) = 8
+  
+    max(10, 10) = 10
+    max(10, 10) = 10
+    min(10, 10) = 10
+    min(10, 10) = 10
+  
+
diff -Nrub clearsilver-0.10.1/cs/test_first_last.cs clearsilver-0.10.2/cs/test_first_last.cs
--- clearsilver-0.10.1/cs/test_first_last.cs	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/cs/test_first_last.cs	2005-09-01 11:36:18.000000000 -0700
@@ -0,0 +1,29 @@
+
+<?cs each:num = Numbers ?>
+  <?cs var:num ?> 
+  is_first: <?cs var:first(num) ?> 
+  is_last: <?cs var:last(num) ?> 
+<?cs /each ?>
+
+<?cs each:day = Days ?>
+  <?cs var:day ?> 
+  is_first: <?cs var:first(day) ?> 
+  is_first: <?cs var:first(day.Abbr) ?> -> never
+  is_last: <?cs var:last(day) ?> 
+  is_last: <?cs var:last(day.Abbr) ?>  -> never
+<?cs /each ?>
+
+Only one, so should be first and last
+<?cs each:test = My.Test2 ?>
+  is_first: <?cs var:first(test) ?> 
+  is_last: <?cs var:last(test) ?> 
+<?cs /each ?>
+
+Testing loop
+<?cs loop:x = 0, 50, 5 ?>
+  <?cs var:x ?>
+  is_first: <?cs var:first(x) ?> 
+  is_first: <?cs var:first(x.foo) ?> -> never
+  is_last: <?cs var:last(x) ?> 
+  is_last: <?cs var:last(x.foo) ?> -> never
+<?cs /loop ?>
diff -Nrub clearsilver-0.10.1/cs/test_first_last.cs.gold clearsilver-0.10.2/cs/test_first_last.cs.gold
--- clearsilver-0.10.1/cs/test_first_last.cs.gold	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/cs/test_first_last.cs.gold	2005-09-07 14:57:26.000000000 -0700
@@ -0,0 +1,130 @@
+Parsing test_first_last.cs
+
+
+  9 
+  is_first: 1 
+  is_last: 0 
+
+  14 
+  is_first: 0 
+  is_last: 1 
+
+
+
+  0 
+  is_first: 1 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  1 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  2 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  3 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  4 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  5 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0  -> never
+
+  6 
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 1 
+  is_last: 0  -> never
+
+
+Only one, so should be first and last
+
+  is_first: 1 
+  is_last: 1 
+
+
+Testing loop
+
+  0
+  is_first: 1 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  5
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  10
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  15
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  20
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  25
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  30
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  35
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  40
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  45
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 0 
+  is_last: 0 -> never
+
+  50
+  is_first: 0 
+  is_first: 0 -> never
+  is_last: 1 
+  is_last: 0 -> never
+
diff -Nrub clearsilver-0.10.1/csharp/Makefile clearsilver-0.10.2/csharp/Makefile
--- clearsilver-0.10.1/csharp/Makefile	2005-06-30 11:51:53.000000000 -0700
+++ clearsilver-0.10.2/csharp/Makefile	2005-12-02 02:34:30.000000000 -0800
@@ -7,10 +7,10 @@
 # common build environment
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 # our targets
 
diff -Nrub clearsilver-0.10.1/dso/Makefile clearsilver-0.10.2/dso/Makefile
--- clearsilver-0.10.1/dso/Makefile	2005-06-30 11:51:53.000000000 -0700
+++ clearsilver-0.10.2/dso/Makefile	2005-12-02 02:35:00.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 NEO_SO = libneo.so
 NEO_STATIC_LIBS =  
@@ -22,7 +22,7 @@
 #	$(LDSHARED) -o $@ $(LDFLAGS) -Wl,-whole-archive $(DLIBS)
 
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
 	$(INSTALL) $(TARGETS) $(DESTDIR)$(PYTHON_SITE)
 
 dsotest: dsotest.c $(NEO_SO)
diff -Nrub clearsilver-0.10.1/imd/Makefile clearsilver-0.10.2/imd/Makefile
--- clearsilver-0.10.1/imd/Makefile	2005-06-30 11:51:53.000000000 -0700
+++ clearsilver-0.10.2/imd/Makefile	2005-12-02 02:35:11.000000000 -0800
@@ -1,16 +1,16 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 IMD_EXE = imd.cgi
 IMD_SRC = imd.c
 IMD_OBJ = $(IMD_SRC:%.c=%.o)
 
-CFLAGS += -I$(NEOTONIC_ROOT) -I/usr/local/include
+CFLAGS += -I/usr/local/include
 DLIBS += -lneo_cgi -lneo_cs -lneo_utl # -lefence
 LIBS += -L$(LIB_DIR) $(DLIBS) -L/usr/local/lib -lgd -ljpeg -lz
 
diff -Nrub clearsilver-0.10.1/java-jni/CS.java clearsilver-0.10.2/java-jni/CS.java
--- clearsilver-0.10.1/java-jni/CS.java	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/CS.java	2005-10-11 11:41:32.000000000 -0700
@@ -6,6 +6,8 @@
 public class CS {
   public int csptr;
   
+  protected HDF globalHDF;
+
   static { 
     try {
       System.loadLibrary("clearsilver-jni");
@@ -16,22 +18,60 @@
   }
   
   public CS(HDF ho) {
+    this.globalHDF = null;
     csptr = _init(ho.hdfptr);
   }
 
-  public void finalize() {
+  // Construct with global HDF to search if local HDF returns null
+  public CS(HDF ho, HDF global) {
+    this(ho);
+
+    this.globalHDF = global;
+    if (global != null) {
+      _setGlobalHdf(csptr,global.hdfptr);
+    }
+  }
+
+  // Specify a new/different global HDF
+  public void setGlobalHDF(HDF global) {
+    _setGlobalHdf(csptr,global.hdfptr);
+    this.globalHDF = global;
+  }
+
+  // Return global hdf in use
+  public HDF getGlobalHDF() {
+    return this.globalHDF;
+  }
+
+  public void close() {
+    if (csptr != 0) {
     _dealloc(csptr);
+      csptr = 0;
+    }
+  }    
+
+  public void finalize() {
+    close();
   }
 
   public void parseFile(String filename) {
+    if (csptr == 0) {
+      throw new NullPointerException("CS is closed.");
+    }
     _parseFile(csptr,filename);
   }
 
   public void parseStr(String content) {
+    if (csptr == 0) {
+      throw new NullPointerException("CS is closed.");
+    }
     _parseStr(csptr,content);
   }
 
   public String render() {
+    if (csptr == 0) {
+      throw new NullPointerException("CS is closed.");
+    }
     return _render(csptr);
   }
   
@@ -40,4 +80,5 @@
   private native void   _parseFile(int ptr,String filename);
   private native void   _parseStr(int ptr, String content);
   private native String _render(int ptr);
+  private native void   _setGlobalHdf(int csptr, int hdfptr);
 };
diff -Nrub clearsilver-0.10.1/java-jni/CSTest.java clearsilver-0.10.2/java-jni/CSTest.java
--- clearsilver-0.10.1/java-jni/CSTest.java	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/CSTest.java	2005-11-16 19:17:07.000000000 -0800
@@ -23,6 +23,13 @@
 
         System.out.println( "----" );
 
+        System.out.println("Testing HDF setSymLink\n");
+        hdf.setSymLink("Foo.Baz2","Foo.Baz");
+        foo = hdf.getValue("Foo.Baz", "30");
+        System.out.println( foo );
+
+        System.out.println( "----" );
+
         System.out.println("Testing HDF get where default value is null\n");
         foo = hdf.getValue("Foo.Bar", null);
         System.out.println("foo = " + foo);
@@ -117,5 +124,15 @@
         System.out.println("Next child name: " + next_hdf.objName());
         next_hdf = next_hdf.objNext();
         System.out.println("Next child (should be null): " + next_hdf + "\n");
+
+	System.out.println("Testing HDF.copy()");
+	HDF one = new HDF();
+	one.setValue("name", "barneyb");
+	one.setValue("age", "25");
+	HDF two = new HDF();
+	two.setValue("entity.type", "person");
+	two.copy("entity.value", one);
+	System.out.println("name should be barneyb: " + 
+	    two.getValue("entity.value.name", "--undefined--") +"\n");
     }
 };
diff -Nrub clearsilver-0.10.1/java-jni/HDF.java clearsilver-0.10.2/java-jni/HDF.java
--- clearsilver-0.10.1/java-jni/HDF.java	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/HDF.java	2005-11-16 19:10:06.000000000 -0800
@@ -35,12 +35,26 @@
     this.root = (parent.root != null) ? parent.root : parent;
   }
 
-  public void finalize() {
+  /** Clean up allocated memory if neccesary. close() allows application
+   *  to force clean up.
+   */
+  public void close() {
     // Only root nodes have ownership of the C HDF pointer, so only a root
-    // node needs to dealloc hdfptr.
-    if ( root == null ) {
+    // node needs to dealloc hdfptr.dir
+    if ( root == null) {
+      if (hdfptr != 0) {
       _dealloc(hdfptr);
+        hdfptr = 0;
+      }
+    }
     }
+
+  /** Call close() just in case when deallocating Java object.
+   */
+  // Should be protected access (like Object).
+  protected void finalize() throws Throwable {
+    close();
+    super.finalize();
   }
 
   /** Loads the contents of the specified HDF file from disk into the current
@@ -48,6 +62,9 @@
    */
   public boolean readFile(String filename) throws IOException,
          FileNotFoundException {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _readFile(hdfptr, filename);
   }
 
@@ -55,23 +72,52 @@
    *  subtree.  If the value does not exist, or cannot be converted to an
    *  integer, default_value will be returned. */
   public int getIntValue(String hdfname, int default_value) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _getIntValue(hdfptr,hdfname,default_value);
   }
 
   /** Retrieves the value at the specified path in this HDF node's subtree.
   */
   public String getValue(String hdfname, String default_value) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _getValue(hdfptr,hdfname,default_value);
   }
 
   /** Sets the value at the specified path in this HDF node's subtree. */
   public void setValue(String hdfname, String value) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     _setValue(hdfptr,hdfname,value);
   }
 
+  /** Remove the specified subtree. */
+  public void removeTree(String hdfname) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
+    _removeTree(hdfptr,hdfname);
+  }
+
+  /** Links the src hdf name to the dest. */
+  public void setSymLink(String hdf_name_src, String hdf_name_dest) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
+    _setSymLink(hdfptr,hdf_name_src,hdf_name_dest);
+  }
+
+
   /** Retrieves the HDF object that is the root of the subtree at hdfpath, or
    *  null if no object exists at that path. */
   public HDF getObj(String hdfpath) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     int obj_ptr = _getObj(hdfptr, hdfpath);
     if ( obj_ptr == 0 ) {
       return null;
@@ -79,15 +125,52 @@
     return new HDF(obj_ptr, this);
   }
 
+  /** Retrieves the HDF for the first child of the root of the subtree at hdfpath, or
+   *  null if no child exists of that path or if the path doesn't exist. */
+  public HDF getChild(String hdfpath) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
+    int obj_ptr = _getChild(hdfptr, hdfpath);
+    if ( obj_ptr == 0 ) {
+      return null;
+    }
+    return new HDF(obj_ptr, this);
+  }
+
+  /** Retrieves the HDF object that is the root of the subtree at
+   *  hdfpath, create the subtree if it doesn't exist */
+  public HDF getOrCreateObj(String hdfpath) {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
+    int obj_ptr = _getObj(hdfptr, hdfpath);
+    if ( obj_ptr == 0 ) {
+      // Create a node
+      _setValue(hdfptr, hdfpath, "");
+      obj_ptr = _getObj( hdfptr, hdfpath );
+      if ( obj_ptr == 0 ) {
+        return null;
+      }
+    }
+    return new HDF(obj_ptr, this);
+  }
+
   /** Returns the name of this HDF node.   The root node has no name, so
    *  calling this on the root node will return null. */
   public String objName() {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _objName(hdfptr);
   }
 
   /** Returns the value of this HDF node, or null if this node has no value.
    *  Every node in the tree can have a value, a child, and a next peer. */
   public String objValue() {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _objValue(hdfptr);
   }
 
@@ -95,6 +178,9 @@
    *  Use this in conjunction with objNext to walk the HDF tree.  Every node
    *  in the tree can have a value, a child, and a next peer. */
   public HDF objChild() {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     int child_ptr = _objChild(hdfptr);
     if ( child_ptr == 0 ) {
       return null;
@@ -106,6 +192,9 @@
    *  sibling.  Use this in conjunction with objChild to walk the HDF tree.
    *  Every node in the tree can have a value, a child, and a next peer. */
   public HDF objNext() {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     int next_ptr = _objNext(hdfptr);
     if ( next_ptr == 0 ) {
       return null;
@@ -113,11 +202,21 @@
     return new HDF(next_ptr, this);
   }
 
+  public void copy(String hdfpath, HDF src) {
+    if (hdfptr == 0 || src.hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
+    _copy(hdfptr, hdfpath, src.hdfptr);
+  }
+
   /**
    * Generates a string representing the content of the HDF tree rooted at
    * this node.
    */
   public String dump() {
+    if (hdfptr == 0) {
+      throw new NullPointerException("HDF is closed.");
+    }
     return _dump(hdfptr);
   }
 
@@ -130,12 +229,16 @@
                                          String default_value);
   private static native void _setValue(int ptr, String hdfname,
                                        String hdf_value);
+  private static native void _removeTree(int ptr, String hdfname);
+  private static native void _setSymLink(int ptr, String hdf_name_src,
+                                       String hdf_name_dest);
   private static native int _getObj(int ptr, String hdfpath);
+  private static native int _getChild(int ptr, String hdfpath);
   private static native int _objChild(int ptr);
   private static native int _objNext(int ptr);
   private static native String _objName(int ptr);
   private static native String _objValue(int ptr);
+  private static native void _copy(int destptr, String hdfpath, int srcptr);
 
   private static native String _dump(int ptr);
 }
-
diff -Nrub clearsilver-0.10.1/java-jni/javatest.gold clearsilver-0.10.2/java-jni/javatest.gold
--- clearsilver-0.10.1/java-jni/javatest.gold	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/javatest.gold	2005-11-16 19:17:29.000000000 -0800
@@ -8,6 +8,10 @@
 10
 20
 ----
+Testing HDF setSymLink
+
+20
+----
 Testing HDF get where default value is null
 
 foo = 10
@@ -39,6 +43,7 @@
 
   10 This is a string without whitespace stripped<hr><pre>Foo.Bar = 10
 Foo.Baz = 20
+Foo.Baz2 : Foo.Baz
 Foo.EscapeTest = abc& 231<>/?
 ClearSilver.WhiteSpaceStrip = 1
 ClearSilver.DisplayDebug = 1
@@ -47,6 +52,7 @@
 
 Foo.Bar = 10
 Foo.Baz = 20
+Foo.Baz2 : Foo.Baz
 Foo.EscapeTest = abc& 231<>/?
 ClearSilver.WhiteSpaceStrip = 1
 ClearSilver.DisplayDebug = 1
@@ -79,3 +85,6 @@
 Next child name: Baz
 Next child (should be null): null
 
+Testing HDF.copy()
+name should be barneyb: barneyb
+
diff -Nrub clearsilver-0.10.1/java-jni/j_neo_cs.c clearsilver-0.10.2/java-jni/j_neo_cs.c
--- clearsilver-0.10.1/java-jni/j_neo_cs.c	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/j_neo_cs.c	2005-10-11 11:41:32.000000000 -0700
@@ -157,3 +157,10 @@
   return retval;
 }
 
+// Change global HDF
+JNIEXPORT void JNICALL Java_org_clearsilver_CS__1setGlobalHdf
+(JNIEnv *env, jobject objclass, jint cs_obj_ptr, jint hdf_obj_ptr) {
+  HDF *hdf = (HDF *)hdf_obj_ptr;
+  CSPARSE *cs = (CSPARSE *)cs_obj_ptr;
+  cs->global_hdf = hdf;
+}
diff -Nrub clearsilver-0.10.1/java-jni/j_neo_util.c clearsilver-0.10.2/java-jni/j_neo_util.c
--- clearsilver-0.10.1/java-jni/j_neo_util.c	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/j_neo_util.c	2005-11-16 20:08:32.000000000 -0800
@@ -99,7 +99,7 @@
 
   hdfname = (*env)->GetStringUTFChars(env,j_hdfname, 0);
 
-  r = hdf_get_int_value(hdf,(char *) hdfname,default_value);
+  r = hdf_get_int_value(hdf, hdfname, default_value);
 
   (*env)->ReleaseStringUTFChars(env,j_hdfname,hdfname);
   return r;
@@ -125,7 +125,7 @@
     default_value = (*env)->GetStringUTFChars(env, j_default_value, 0);
   }
 
-  r = hdf_get_value(hdf, (char *)hdfname, (char *)default_value);
+  r = hdf_get_value(hdf, hdfname, default_value);
 
   (*env)->ReleaseStringUTFChars(env, j_hdfname, hdfname);
   retval = (r ? (*env)->NewStringUTF(env, r) : 0);
@@ -153,7 +153,7 @@
   } else {
     value = NULL;
   }
-  err = hdf_set_value(hdf, (char *)hdfname, (char *)value);
+  err = hdf_set_value(hdf, hdfname, value);
 
   (*env)->ReleaseStringUTFChars(env, j_hdfname, hdfname);
   if (value) {
@@ -166,6 +166,59 @@
   }
 }
 
+JNIEXPORT void JNICALL Java_org_clearsilver_HDF__1removeTree(
+    JNIEnv *env, jclass objClass,
+    jint hdf_obj_ptr, jstring j_hdfname) {
+  HDF *hdf = (HDF *)hdf_obj_ptr;
+  NEOERR *err;
+  const char *hdfname;
+
+  if (!j_hdfname) {
+    throwNullPointerException(env, "hdfname argument was null");
+    return;
+  }
+  hdfname = (*env)->GetStringUTFChars(env, j_hdfname, 0);
+  err = hdf_remove_tree(hdf, hdfname);
+
+  (*env)->ReleaseStringUTFChars(env, j_hdfname, hdfname);
+
+  if (err != STATUS_OK) {
+    // Throw an exception
+    jNeoErr(env, err);
+  }
+}
+
+JNIEXPORT void JNICALL Java_org_clearsilver_HDF__1setSymLink(
+    JNIEnv *env, jclass objClass,
+    jint hdf_obj_ptr, jstring j_hdf_name_src, jstring j_hdf_name_dest) {
+  HDF *hdf = (HDF *)hdf_obj_ptr;
+  NEOERR *err;
+  const char *hdf_name_src;
+  const char *hdf_name_dest;
+
+  if (!j_hdf_name_src) {
+    throwNullPointerException(env, "hdf_name_src argument was null");
+    return;
+  }
+  hdf_name_src = (*env)->GetStringUTFChars(env, j_hdf_name_src, 0);
+
+  if (!j_hdf_name_dest) {
+    throwNullPointerException(env, "hdf_name_dest argument was null");
+    return;
+  }
+  hdf_name_dest = (*env)->GetStringUTFChars(env, j_hdf_name_dest, 0);
+
+  err = hdf_set_symlink(hdf, hdf_name_src, hdf_name_dest);
+
+  (*env)->ReleaseStringUTFChars(env, j_hdf_name_src, hdf_name_src);
+  (*env)->ReleaseStringUTFChars(env, j_hdf_name_dest, hdf_name_dest);
+
+  if (err != STATUS_OK) {
+    // Throw an exception
+    jNeoErr(env, err);
+  }
+}
+
 JNIEXPORT jstring JNICALL Java_org_clearsilver_HDF__1dump(
     JNIEnv *env, jclass objClass,
     jint hdf_obj_ptr) {
@@ -216,7 +269,6 @@
   return retval;
 }
 
-
 JNIEXPORT jint JNICALL Java_org_clearsilver_HDF__1getObj(
     JNIEnv *env, jclass objClass, jint hdf_obj_ptr, jstring j_hdf_path) {
   HDF *hdf = (HDF *)hdf_obj_ptr;
@@ -229,6 +281,18 @@
   return (jint)obj_hdf;
 }
 
+JNIEXPORT jint JNICALL Java_org_clearsilver_HDF__1getChild(
+    JNIEnv *env, jclass objClass, jint hdf_obj_ptr, jstring j_hdf_path) {
+  HDF *hdf = (HDF *)hdf_obj_ptr;
+  HDF *obj_hdf = NULL;
+  const char *hdf_path;
+
+  hdf_path = (*env)->GetStringUTFChars(env, j_hdf_path, 0);
+  obj_hdf = hdf_get_child(hdf, (char*)hdf_path);
+  (*env)->ReleaseStringUTFChars(env, j_hdf_path, hdf_path);
+  return (jint)obj_hdf;
+}
+
 JNIEXPORT jint JNICALL Java_org_clearsilver_HDF__1objChild(
     JNIEnv *env, jclass objClass, jint hdf_obj_ptr) {
   HDF *hdf = (HDF *)hdf_obj_ptr;
@@ -273,3 +337,15 @@
   return retval;
 }
 
+JNIEXPORT void JNICALL Java_org_clearsilver_HDF__1copy
+  (JNIEnv *env, jclass objClass, jint hdf_dest_ptr, jstring j_hdf_path, 
+   jint hdf_src_ptr) {
+  HDF *dest = (HDF *)hdf_dest_ptr;
+  HDF *src = (HDF *)hdf_src_ptr;
+  const char *hdf_path;
+
+  hdf_path = (*env)->GetStringUTFChars(env, j_hdf_path, 0);
+  hdf_copy(dest, hdf_path, src);
+  (*env)->ReleaseStringUTFChars(env, j_hdf_path, hdf_path);
+}
+
Binary files clearsilver-0.10.1/java-jni/libclearsilver-jni.so and clearsilver-0.10.2/java-jni/libclearsilver-jni.so differ
diff -Nrub clearsilver-0.10.1/java-jni/Makefile clearsilver-0.10.2/java-jni/Makefile
--- clearsilver-0.10.1/java-jni/Makefile	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/java-jni/Makefile	2005-12-02 02:35:28.000000000 -0800
@@ -2,10 +2,10 @@
 .SUFFIXES: .java .class
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 NEO_UTIL_SO = libclearsilver-jni.so
 NEO_UTIL_JAVA_SRC = HDF.java CS.java # CGI.java
@@ -16,7 +16,7 @@
 NEO_UTIL_OBJ = $(NEO_UTIL_SRC:%.c=%.o)
 
 
-CFLAGS += -I$(NEOTONIC_ROOT) -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux
+CFLAGS += $(JAVA_INCLUDE_PATH)
 DLIBS += -lneo_cgi -lneo_cs -lneo_utl 
 LIBS += -L$(LIB_DIR) $(DLIBS)
 
@@ -51,7 +51,7 @@
 	LD_LIBRARY_PATH=$(NEOTONIC_ROOT)/java-jni; export LD_LIBRARY_PATH; \
 	CLASSPATH=$(NEO_UTIL_JAVA_JAR):.; export CLASSPATH; \
 	$(JAVA_PATH)/bin/java CSTest > javatest.out; \
-	diff --brief javatest.out javatest.gold  > /dev/null 2>&1; \
+	diff javatest.out javatest.gold  > /dev/null 2>&1; \
 	return_code=$$?; \
 	if [ $$return_code -ne 0 ]; then \
 	  diff javatest.out javatest.gold > javatest.err; \
diff -Nrub clearsilver-0.10.1/m4/ac_jni_include_dirs.m4 clearsilver-0.10.2/m4/ac_jni_include_dirs.m4
--- clearsilver-0.10.1/m4/ac_jni_include_dirs.m4	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/m4/ac_jni_include_dirs.m4	2005-11-16 19:45:29.000000000 -0800
@@ -0,0 +1,97 @@
+dnl @synopsis AC_JNI_INCLUDE_DIR
+dnl
+dnl AC_JNI_INCLUDE_DIR finds include directories needed
+dnl for compiling programs using the JNI interface.
+dnl
+dnl JNI include directories are usually in the java distribution
+dnl This is deduced from the value of JAVAC.  When this macro
+dnl completes, a list of directories is left in the variable
+dnl JNI_INCLUDE_DIRS.
+dnl
+dnl Example usage follows:
+dnl
+dnl     AC_JNI_INCLUDE_DIR
+dnl
+dnl     for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+dnl     do
+dnl             CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
+dnl     done
+dnl
+dnl If you want to force a specific compiler:
+dnl
+dnl - at the configure.in level, set JAVAC=yourcompiler before calling
+dnl AC_JNI_INCLUDE_DIR
+dnl
+dnl - at the configure level, setenv JAVAC
+dnl
+dnl Note: This macro can work with the autoconf M4 macros for Java programs.
+dnl This particular macro is not part of the original set of macros.
+dnl
+dnl @author Don Anderson <dda@sleepycat.com>
+dnl @version $Id: ac_jni_include_dirs.m4,v 1.3 2004/12/24 01:16:37 guidod Exp $
+dnl
+AC_DEFUN([AC_JNI_INCLUDE_DIR],[
+
+JNI_INCLUDE_DIRS=""
+
+test "x$JAVAC" = x && AC_MSG_ERROR(['$JAVAC' undefined])
+AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no)
+test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path])
+
+_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
+_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
+case "$host_os" in
+        darwin*)        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+                        _JINC="$_JTOPDIR/Headers";;
+        *)              _JINC="$_JTOPDIR/include";;
+esac
+if test -f "$_JINC/jni.h"; then
+        JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
+else
+        _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+        if test -f "$_JTOPDIR/include/jni.h"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
+        else
+                AC_MSG_ERROR([cannot find java include files])
+        fi
+fi
+
+# get the likely subdirectories for system specific java includes
+case "$host_os" in
+bsdi*)          _JNI_INC_SUBDIRS="bsdos";;
+linux*)         _JNI_INC_SUBDIRS="linux genunix";;
+osf*)           _JNI_INC_SUBDIRS="alpha";;
+solaris*)       _JNI_INC_SUBDIRS="solaris";;
+mingw*)			_JNI_INC_SUBDIRS="win32";;
+cygwin*)		_JNI_INC_SUBDIRS="win32";;
+*)              _JNI_INC_SUBDIRS="genunix";;
+esac
+
+# add any subdirectories that are present
+for JINCSUBDIR in $_JNI_INC_SUBDIRS
+do
+        if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
+                JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
+        fi
+done
+])
+
+# _ACJNI_FOLLOW_SYMLINKS <path>
+# Follows symbolic links on <path>,
+# finally setting variable _ACJNI_FOLLOWED
+# --------------------
+AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[
+# find the include directory relative to the javac executable
+_cur="$1"
+while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
+        AC_MSG_CHECKING(symlink for $_cur)
+        _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
+        case "$_slink" in
+        /*) _cur="$_slink";;
+        # 'X' avoids triggering unwanted echo options.
+        *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";;
+        esac
+        AC_MSG_RESULT($_cur)
+done
+_ACJNI_FOLLOWED="$_cur"
+])# _ACJNI
diff -Nrub clearsilver-0.10.1/Makefile clearsilver-0.10.2/Makefile
--- clearsilver-0.10.1/Makefile	2005-07-27 19:34:41.000000000 -0700
+++ clearsilver-0.10.2/Makefile	2005-12-02 02:33:25.000000000 -0800
@@ -5,7 +5,7 @@
 #
 #
 
-NEOTONIC_ROOT = ./
+NEOTONIC_ROOT = .
 
 include rules.mk
 
@@ -35,7 +35,7 @@
 	  fi; \
 	done
 
-install: all man
+install: all
 	./mkinstalldirs $(DESTDIR)$(cs_includedir)
 	./mkinstalldirs $(DESTDIR)$(bindir)
 	./mkinstalldirs $(DESTDIR)$(libdir)
@@ -108,10 +108,10 @@
 		mkdir -p $$mdir; \
 	done
 
-CS_DISTDIR = clearsilver-0.10.1
-CS_LABEL = CLEARSILVER-0_10_1
+CS_DISTDIR = clearsilver-0.10.2
+CS_LABEL = CLEARSILVER-0_10_2
 CS_FILES = README README.python INSTALL LICENSE CS_LICENSE rules.mk.in Makefile acconfig.h autogen.sh config.guess config.sub configure.in cs_config.h.in mkinstalldirs install-sh ClearSilver.h
-CS_DIRS = util cs cgi python scripts mod_ecs imd java-jni perl ruby dso csharp ports contrib
+CS_DIRS = util cs cgi python scripts mod_ecs imd java-jni perl ruby dso csharp ports contrib m4
 
 cs_dist:
 	@if p4 labels Makefile | grep "${CS_LABEL}"; then \
@@ -125,4 +125,6 @@
 	mkdir -p $(CS_DISTDIR)
 	tar -cf - `p4 files $(CS_FILES) $(addsuffix /..., $(CS_DIRS)) | cut -d'#' -f 1 | sed -e "s|//depot/google3/third_party/clearsilver/core/||"` | (cd $(CS_DISTDIR); tar -xf -)
 	$(MAKE) -C $(CS_DISTDIR) man distclean
+	chmod -R u+w $(CS_DISTDIR)
+	chmod -R a+r $(CS_DISTDIR)
 	tar chozf $(CS_DISTDIR).tar.gz $(CS_DISTDIR)
diff -Nrub clearsilver-0.10.1/mod_ecs/Makefile clearsilver-0.10.2/mod_ecs/Makefile
--- clearsilver-0.10.1/mod_ecs/Makefile	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/mod_ecs/Makefile	2005-12-02 02:35:34.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 MOD_ECS_SRC = mod_ecs.c
 MOD_ECS_SO = mod_ecs.so
@@ -20,7 +20,7 @@
 	$(APXS) -c -o $@ $(MOD_ECS_SRC)
 
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(libexecdir)
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(libexecdir)
 	$(INSTALL) $(MOD_ECS_SO) $(DESTDIR)$(libexecdir)
 
 # Hmm, install it in the default apache place, or in with the 
diff -Nrub clearsilver-0.10.1/perl/ClearSilver.xs clearsilver-0.10.2/perl/ClearSilver.xs
--- clearsilver-0.10.1/perl/ClearSilver.xs	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/perl/ClearSilver.xs	2005-12-02 03:08:39.000000000 -0800
@@ -150,6 +150,22 @@
     OUTPUT:
         RETVAL
 
+
+int
+perlhdf_copy(hdf, name, src);
+        ClearSilver::HDF hdf
+        char* name
+        ClearSilver::HDF src
+    CODE:
+        hdf->err = hdf_copy(hdf->hdf, name, src->hdf);
+        if (hdf->err == STATUS_OK) {
+            RETVAL = 0;
+        } else {
+            RETVAL = 1;
+        }
+    OUTPUT:
+        RETVAL
+
 int
 perlhdf_readFile(hdf, filename)
 	ClearSilver::HDF hdf
@@ -311,6 +327,39 @@
         RETVAL
 
 
+int
+perlhdf_setSymlink(hdf, src, dest)
+	ClearSilver::HDF hdf;
+	char* src;
+	char* dest;
+    PREINIT:
+	NEOERR* err;
+    CODE:
+      	err = hdf_set_symlink (hdf->hdf, src, dest);
+       	if (err == STATUS_OK) {
+       	    RETVAL = 1;
+       	} else {
+       	    RETVAL = 0;
+       	}
+    OUTPUT:
+        RETVAL
+
+
+int
+perlhdf_removeTree(hdf, name)
+	ClearSilver::HDF hdf;
+	char* name;
+    PREINIT:	
+        NEOERR* err;
+    CODE:
+        err = hdf_remove_tree(hdf->hdf, name);
+       	if (err == STATUS_OK) {
+       	    RETVAL = 1;
+       	} else {
+       	    RETVAL = 0;
+       	}
+    OUTPUT:
+        RETVAL
 
 
 MODULE = ClearSilver		PACKAGE = ClearSilver::CS	PREFIX = perlcs_
diff -Nrub clearsilver-0.10.1/perl/Makefile.PL clearsilver-0.10.2/perl/Makefile.PL
--- clearsilver-0.10.1/perl/Makefile.PL	2005-06-30 11:51:54.000000000 -0700
+++ clearsilver-0.10.2/perl/Makefile.PL	2005-11-16 19:23:56.000000000 -0800
@@ -8,7 +8,8 @@
     ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM => 'ClearSilver.pm', # retrieve abstract from module
        AUTHOR     => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>') : ()),
-    'LIBS'		=> ['-L../libs -lneo_cgi -lneo_cs -lneo_utl'], 
+       # TODO: don't include -lz if we aren't depending on it
+    'LIBS'		=> ['-L../libs -lneo_cgi -lneo_cs -lneo_utl -lz'], 
     'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
 	# Insert -I. if you add *.h files later:
     'INC'		=> '-I../',
diff -Nrub clearsilver-0.10.1/perl/test.pl clearsilver-0.10.2/perl/test.pl
--- clearsilver-0.10.1/perl/test.pl	2005-06-30 11:51:55.000000000 -0700
+++ clearsilver-0.10.2/perl/test.pl	2005-12-02 03:08:44.000000000 -0800
@@ -1,6 +1,5 @@
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl test.pl'
-
 #########################
 
 # change 'tests => 1' to 'tests => last_test_to_print';
@@ -51,6 +50,7 @@
 $lev2_node ? result($testnum, 1) : result($testnum, 0);
 $testnum++;
 
+
 #
 # test objName()
 #
@@ -100,6 +100,38 @@
 $testnum++;
 
 #
+# test copy tree
+# 
+$copy = ClearSilver::HDF->new();
+$ret = $copy->copy("", $hdf);
+$ret ? result($testnum, 0) : result($testnum, 1);
+$testnum++;
+$str = $copy->getValue("Data.1", "default");
+print $str
+($str eq "Value1") ? result($testnum, 1) : result($testnum, 0);     
+$testnum++;
+  
+#
+# test setSymlink()
+#
+$ret = $copy->setSymlink( "BottomNode" ,"TopNode");
+$ret ? result($testnum, 1) : result($testnum, 0);
+$testnum++;
+$tmp = $copy->getObj("BottomNode.2nd1");
+$tmp ? result($testnum, 1) : result($testnum, 0);
+$testnum++;
+
+#
+# test removeTree()
+#
+$ret = $copy->removeTree("TopNode");
+$ret ? result($testnum, 1) : result($testnum, 0);
+$testnum++;
+$tmp = $copy->getObj("TopNode.2nd1");
+$tmp ? result($testnum, 0) : result($testnum, 1);
+$testnum++;
+
+#
 # test sortObj()
 #
 $sort_top = $hdf->getObj("Sort.Data");
diff -Nrub clearsilver-0.10.1/ports/rpm/clearsilver.spec clearsilver-0.10.2/ports/rpm/clearsilver.spec
--- clearsilver-0.10.1/ports/rpm/clearsilver.spec	2005-06-30 11:51:55.000000000 -0700
+++ clearsilver-0.10.2/ports/rpm/clearsilver.spec	2005-10-21 16:03:41.000000000 -0700
@@ -53,11 +53,11 @@
 
 Summary: Neotonic ClearSilver
 Name: clearsilver
-Version: 0.9.7
+Version: 0.10.2
 Release: 1
 Copyright: Open Source - Neotonic ClearSilver License (Apache 1.1 based)
 Group: Development/Libraries
-Source: http://www.clearsilver.net/downloads/clearsilver-0.9.7.tar.gz
+Source: http://www.clearsilver.net/downloads/clearsilver-0.10.2.tar.gz
 URL: http://www.clearsilver.net/
 Vendor: Neotonic Software Corporation, Inc.
 Packager: Brandon Long <blong@neotonic.com>
diff -Nrub clearsilver-0.10.1/python/examples/base/SafeHtml.py clearsilver-0.10.2/python/examples/base/SafeHtml.py
--- clearsilver-0.10.1/python/examples/base/SafeHtml.py	2005-06-30 11:51:55.000000000 -0700
+++ clearsilver-0.10.2/python/examples/base/SafeHtml.py	2005-11-03 15:17:38.000000000 -0800
@@ -109,7 +109,8 @@
     if SafeHtml._stripTags.has_key(tag):
       self.safe_end_strip()
       # sys.stderr.write("End Stripping tag %s: %d\n" % (tag, self._stripping))
-    elif SafeHtml._skipTags.has_key(tag):
+    elif self._stripping == 0:
+      if SafeHtml._skipTags.has_key(tag):
       pass
     elif SafeHtml._matchTags.has_key(tag):
       if self._matchDict.has_key(tag):
diff -Nrub clearsilver-0.10.1/python/Makefile clearsilver-0.10.2/python/Makefile
--- clearsilver-0.10.1/python/Makefile	2005-06-30 11:51:55.000000000 -0700
+++ clearsilver-0.10.2/python/Makefile	2005-12-02 02:35:46.000000000 -0800
@@ -1,17 +1,17 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 NEO_UTIL_SO = neo_cgi.so
 NEO_UTIL_PYD = neo_cgi.pyd
 NEO_UTIL_SRC = neo_cgi.c neo_util.c neo_cs.c
 NEO_UTIL_OBJ = $(NEO_UTIL_SRC:%.c=%.o)
 
-CFLAGS += -I$(NEOTONIC_ROOT) $(PYTHON_INC)
+CFLAGS += $(PYTHON_INC)
 DLIBS += -lneo_cgi -lneo_cs -lneo_utl 
 LIBS += -L$(LIB_DIR) $(DLIBS) $(DB2_LIB)
 
@@ -25,7 +25,7 @@
 
 $(NEO_UTIL_SO): setup.py $(NEO_UTIL_SRC) $(DEP_LIBS)
 	rm -f $(NEO_UTIL_SO)
-	$(PYTHON) setup.py build_ext --inplace
+	CC="$(CC)" LDSHARED="$(LDSHARED)" $(PYTHON) setup.py build_ext --inplace
 
 OLD_NEO_UTIL_SO:
 	$(LDSHARED) -o $@ $(LDFLAGS) $(NEO_UTIL_OBJ) $(LIBS)
@@ -41,7 +41,7 @@
 		$(PYTHON_LIB) $(LIBS)
 
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
 	$(INSTALL) $(TARGETS) $(DESTDIR)$(PYTHON_SITE)
 
 clean:
diff -Nrub clearsilver-0.10.1/python/neo_cgi.c clearsilver-0.10.2/python/neo_cgi.c
--- clearsilver-0.10.1/python/neo_cgi.c	2005-06-30 18:30:18.000000000 -0700
+++ clearsilver-0.10.2/python/neo_cgi.c	2005-11-30 20:15:03.000000000 -0800
@@ -341,7 +341,7 @@
 
 static PyObject * p_cgi_url_escape (PyObject *self, PyObject *args)
 {
-  unsigned char *s, *esc, *o = NULL;
+  char *s, *esc, *o = NULL;
   NEOERR *err;
   PyObject *rv;
 
@@ -374,7 +374,7 @@
 
 static PyObject * p_html_escape (PyObject *self, PyObject *args)
 {
-  unsigned char *s, *esc;
+  char *s, *esc;
   NEOERR *err;
   PyObject *rv;
   int len;
@@ -391,7 +391,7 @@
 
 static PyObject * p_html_strip (PyObject *self, PyObject *args)
 {
-  unsigned char *s, *esc;
+  char *s, *esc;
   NEOERR *err;
   PyObject *rv;
   int len;
@@ -408,7 +408,7 @@
 
 static PyObject * p_text_html (PyObject *self, PyObject *args, PyObject *keywds)
 {
-  unsigned char *s, *esc;
+  char *s, *esc;
   NEOERR *err;
   PyObject *rv;
   int len;
diff -Nrub clearsilver-0.10.1/python/setup.py clearsilver-0.10.2/python/setup.py
--- clearsilver-0.10.1/python/setup.py	2005-06-30 11:51:56.000000000 -0700
+++ clearsilver-0.10.2/python/setup.py	2005-10-21 16:19:30.000000000 -0700
@@ -1,11 +1,14 @@
 
 import os, string, re, sys
 from distutils.core import setup, Extension
+from distutils import sysconfig
 
-VERSION = "0.9.1"
+VERSION = "0.10.2"
 INC_DIRS = ["../"]
 LIBRARIES = ["neo_cgi", "neo_cs", "neo_utl"]
 LIB_DIRS = ["../libs"]
+CC = "gcc"
+LDSHARED = "gcc -shared"
 
 ## ARGGH!!  It looks like you can only specify a single item on the
 ## command-line or in the setup.cfg file for options which take multiple
@@ -53,22 +56,45 @@
       	inserted.append(lib_path)
 	sys.stderr.write("adding lib_path %s\n" % lib_path)
     LIB_DIRS = inserted + LIB_DIRS
+  elif var == "CC":
+    CC = val
+  elif var == "LDSHARED":
+    LDSHARED = val
+
+
+def expand_var(var, vars):
+  def replace_var(m, variables=vars):
+    var = m.group(1)
+    if var[:2] == "$(" and var[-1] == ")":
+      var = variables.get(var[2:-1], "")
+    return var
+  return re.sub('(\$\([^\)]*\))', replace_var, var)
 
 def expand_vars(vlist, vars):
   nlist = []
   for val in vlist:
-    if val[:2] == "$(" and val[-1] == ")":
-      var = val[2:-1]
-      val = vars.get(val, "")
+    val = expand_var(val, vars)
       if val: nlist.append(val)
-    else:
-      nlist.append(val)
   return nlist
 
 INC_DIRS = expand_vars(INC_DIRS, make_vars)
 LIB_DIRS = expand_vars(LIB_DIRS, make_vars)
 LIBRARIES = expand_vars(LIBRARIES, make_vars)
 
+CC = os.environ.get('CC', expand_var(CC, make_vars))
+LDSHARED = os.environ.get('LDSHARED', expand_var(CC, make_vars))
+
+# HACK!  The setup/Makefile may not have the hermetic/cross-compiler entries
+# for the compiler that we need, so override them here!
+given_cc = sysconfig.get_config_var('CC')
+if given_cc != CC and given_cc[0] != '/':
+  sys.stderr.write("Overriding setup's CC from %s to %s\n" % (given_cc, CC))
+  try:
+    sysconfig._config_vars['CC'] = CC
+    sysconfig._config_vars['LDSHARED'] = LDSHARED
+  except AttributeError:
+    pass
+
 setup(name="clearsilver",
       version=VERSION,
       description="Python ClearSilver Wrapper",
diff -Nrub clearsilver-0.10.1/ruby/hdftest.out clearsilver-0.10.2/ruby/hdftest.out
--- clearsilver-0.10.1/ruby/hdftest.out	1969-12-31 16:00:00.000000000 -0800
+++ clearsilver-0.10.2/ruby/hdftest.out	2005-12-14 16:32:30.000000000 -0800
@@ -0,0 +1,27 @@
+1 = farming
+2 = sewing
+3 = bowling
+party.1 [Drool="True"]  = baloons
+party.2 [Pink]  = noise makers
+party.3 << EOM
+telling long
+stories
+EOM
+arf.1 = farming
+arf.2 = sewing
+arf.3 = bowling
+arf.party.1 [Drool="True"]  = baloons
+arf.party.2 [Pink]  = noise makers
+arf.party.3 << EOM
+telling long
+stories
+EOM
+party.2 attr (Pink=1)
+This is a funny test. farming.
+
+baloons
+
+noise makers
+
+telling long
+stories
diff -Nrub clearsilver-0.10.1/ruby/Makefile clearsilver-0.10.2/ruby/Makefile
--- clearsilver-0.10.1/ruby/Makefile	2005-06-30 11:51:56.000000000 -0700
+++ clearsilver-0.10.2/ruby/Makefile	2005-12-02 02:35:52.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 all: config.save ext/hdf/hdf.so testrb
 
diff -Nrub clearsilver-0.10.1/rules.mk.in clearsilver-0.10.2/rules.mk.in
--- clearsilver-0.10.1/rules.mk.in	2005-07-02 17:13:51.000000000 -0700
+++ clearsilver-0.10.2/rules.mk.in	2005-12-02 03:25:19.000000000 -0800
@@ -15,7 +15,7 @@
 OSNAME := $(shell uname -rs | cut -f 1-2 -d "." | cut -f 1 -d "-")
 OSTYPE := $(shell uname -s)
 
-LIB_DIR    = $(NEOTONIC_ROOT)libs/
+LIB_DIR    = $(NEOTONIC_ROOT)/libs/
 
 ## Installation Directories
 srcdir = @srcdir@
@@ -50,12 +50,22 @@
 
 @USE_MINGW32@
 
+PICFLG = -fPIC
+ifeq ($(OSTYPE),OSF1)
+PICFLG =
+endif
+ifeq ($(OSNAME),MINGW32_NT)
+PICFLG =
+endif
+
+
 ## -------------- base (Linux/Neotonic) options
 
 PYTHON_INC = @PYTHON_INC@
 PYTHON_LIB = @PYTHON_LIB@
 PYTHON_SITE = @PYTHON_SITE@
 JAVA_PATH  = @JAVA_PATH@
+JAVA_INCLUDE_PATH = @JAVA_INCLUDE_PATH@
 CSHARP_PATH = @CSHARP_PATH@
 
 ## Programs
@@ -73,13 +83,13 @@
 PERL	   = @PERL@
 RUBY       = @RUBY@
 
-CFLAGS     = @CFLAGS@ -Wall -I$(NEOTONIC_ROOT) @CPPFLAGS@
-CPPFLAGS   = -I$(NEOTONIC_ROOT) -fPIC @CPPFLAGS@
+CPPFLAGS   = -I$(NEOTONIC_ROOT) @CPPFLAGS@
+CFLAGS     = @CFLAGS@ -Wall $(CPPFLAGS) $(PICFLG)
 OUTPUT_OPTION = -o $@
 LD         = $(CC) -o
 LDFLAGS    = -L$(LIB_DIR) @LDFLAGS@
-LDSHARED   = $(CC) -shared -fPIC
-CPPLDSHARED   = $(CPP) -shared -fPIC
+LDSHARED   = $(CC) -shared $(PICFLG)
+CPPLDSHARED   = $(CPP) -shared $(PICFLG)
 AR         = @AR@ cr
 RANLIB     = @RANLIB@
 DEP_LIBS   = $(DLIBS:-l%=$(LIB_DIR)lib%.a)
@@ -135,15 +145,18 @@
 .PHONY: depend
 depend: Makefile.depends
 
+SOURCE_FILES := $(wildcard *.c)
 Makefile.depends: $(NEOTONIC_ROOT)/rules.mk Makefile
 	@echo "*******************************************"
 	@echo "** Building Dependencies "
 	@echo "** OSNAME: $(OSTYPE)"
 	@rm -f Makefile.depends
 	@touch Makefile.depends
-	@for II in `find . -maxdepth 1 -name "*.c" -print`; do \
+	@if test "x" != "x$(SOURCE_FILES)"; then \
+	  for II in "$(SOURCE_FILES)"; do \
 		gcc -M -MG ${CFLAGS} $$II >> Makefile.depends; \
-	done;
+	  done; \
+	 fi
 	@echo "** (done) "
 
 DEPEND_FILE := $(shell find . -name Makefile.depends -print)
diff -Nrub clearsilver-0.10.1/util/filter.c clearsilver-0.10.2/util/filter.c
--- clearsilver-0.10.1/util/filter.c	2005-06-30 11:57:56.000000000 -0700
+++ clearsilver-0.10.2/util/filter.c	2005-11-16 19:26:23.000000000 -0800
@@ -129,7 +129,7 @@
       close (pe[1]);
     }
 
-    execl ("/bin/sh", "sh", "-c", cmd, NULL);
+    execl ("/bin/sh", "sh", "-c", cmd, (void *)NULL);
     _exit (127);
   }
   else if (rpid == -1)
diff -Nrub clearsilver-0.10.1/util/Makefile clearsilver-0.10.2/util/Makefile
--- clearsilver-0.10.1/util/Makefile	2005-06-30 11:51:57.000000000 -0700
+++ clearsilver-0.10.2/util/Makefile	2005-12-02 02:36:00.000000000 -0800
@@ -1,10 +1,10 @@
 
 
 ifeq ($(NEOTONIC_ROOT),)
-NEOTONIC_ROOT = ../
+NEOTONIC_ROOT = ..
 endif
 
-include $(NEOTONIC_ROOT)rules.mk
+include $(NEOTONIC_ROOT)/rules.mk
 
 UTL_LIB = $(LIB_DIR)libneo_utl.a
 UTL_SRC = neo_err.c neo_files.c neo_misc.c neo_rand.c ulist.c neo_hdf.c \
@@ -22,7 +22,7 @@
 	$(RANLIB) $@
 
 install: all
-	$(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(cs_includedir)/util
+	$(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/util
 	$(INSTALL) -m 644 $(UTL_HDR) $(DESTDIR)$(cs_includedir)/util
 	$(INSTALL) -m 644 $(UTL_LIB) $(DESTDIR)$(libdir)
 
diff -Nrub clearsilver-0.10.1/util/neo_date.c clearsilver-0.10.2/util/neo_date.c
--- clearsilver-0.10.1/util/neo_date.c	2005-06-30 11:58:40.000000000 -0700
+++ clearsilver-0.10.2/util/neo_date.c	2005-11-30 20:04:27.000000000 -0800
@@ -13,6 +13,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <time.h>
 #include <limits.h>
 #include "util/neo_misc.h"
@@ -41,8 +42,16 @@
 
 void neo_time_expand (const time_t tt, const char *timezone, struct tm *ttm)
 {
+  const char *cur_tz = getenv("TZ");
+  int change_back = 0;
+  if (cur_tz == NULL || strcmp(timezone, cur_tz)) {
   time_set_tz (timezone);
+    change_back = 1;
+  }
   localtime_r (&tt, ttm);
+  if (cur_tz && change_back) {
+    time_set_tz(cur_tz);
+  }
 }
 
 time_t neo_time_compact (struct tm *ttm, const char *timezone)
@@ -50,10 +59,18 @@
   time_t r;
   int save_isdst = ttm->tm_isdst;
 
+  const char *cur_tz = getenv("TZ");
+  int change_back = 0;
+  if (cur_tz == NULL || strcmp(timezone, cur_tz)) {
   time_set_tz (timezone);
+    change_back = 1;
+  }
   ttm->tm_isdst = -1;
   r = mktime(ttm);
   ttm->tm_isdst = save_isdst;
+  if (cur_tz && change_back) {
+    time_set_tz(cur_tz);
+  }
   return r;
 }
 
diff -Nrub clearsilver-0.10.1/util/neo_err.h clearsilver-0.10.2/util/neo_err.h
--- clearsilver-0.10.1/util/neo_err.h	2005-06-30 11:59:37.000000000 -0700
+++ clearsilver-0.10.2/util/neo_err.h	2005-11-21 18:51:19.000000000 -0800
@@ -12,6 +12,11 @@
 #ifndef __NEO_ERR_H_
 #define __NEO_ERR_H_ 1
 
+/* For compilers (well, cpp actually) which don't define __PRETTY_FUNCTION__ */
+#ifndef __PRETTY_FUNCTION__
+#define __PRETTY_FUNCTION__ "unknown_function"
+#endif
+
 __BEGIN_DECLS
 
 /* For 64 bit systems which don't like mixing ints and pointers, we have the
@@ -66,14 +71,25 @@
  * returns: a pointer to a NEOERR, or INTERNAL_ERR if allocation of
  *          NEOERR fails
  */
+#ifdef __GNUC__
 #define nerr_raise(e,f,a...) \
    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
+#else
+#define nerr_raise(e,f,...) \
+   nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
+#endif
 
 NEOERR *nerr_raisef (const char *func, const char *file, int lineno, 
                      NERR_TYPE error, const char *fmt, ...);
 
+
+#ifdef __GNUC__
 #define nerr_raise_errno(e,f,a...) \
    nerr_raise_errnof(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
+#else
+#define nerr_raise_errno(e,f,...) \
+   nerr_raise_errnof(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
+#endif
 
 NEOERR *nerr_raise_errnof (const char *func, const char *file, int lineno, 
                            int error, const char *fmt, ...);
@@ -104,8 +120,13 @@
  *            the error is occuring.
  * returns: a pointer to an error
  */
+#ifdef __GNUC__
 #define nerr_pass_ctx(e,f,a...) \
    nerr_pass_ctxf(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
+#else
+#define nerr_pass_ctx(e,f,...) \
+   nerr_pass_ctxf(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
+#endif
 NEOERR *nerr_pass_ctxf (const char *func, const char *file, int lineno, NEOERR *err, 
                        const char *fmt, ...);
 
diff -Nrub clearsilver-0.10.1/util/neo_hash.c clearsilver-0.10.2/util/neo_hash.c
--- clearsilver-0.10.1/util/neo_hash.c	2005-06-30 11:51:59.000000000 -0700
+++ clearsilver-0.10.2/util/neo_hash.c	2005-11-30 20:06:03.000000000 -0800
@@ -278,7 +278,7 @@
 
 UINT32 ne_hash_str_hash(const void *a)
 {
-  return ne_crc((char *)a, strlen((const char *)a));
+  return ne_crc((unsigned char *)a, strlen((const char *)a));
 }
 
 int ne_hash_int_comp(const void *a, const void *b)
diff -Nrub clearsilver-0.10.1/util/neo_hdf.c clearsilver-0.10.2/util/neo_hdf.c
--- clearsilver-0.10.1/util/neo_hdf.c	2005-06-30 17:40:04.000000000 -0700
+++ clearsilver-0.10.2/util/neo_hdf.c	2005-12-14 16:08:58.000000000 -0800
@@ -49,7 +49,7 @@
 static UINT32 hash_hdf_hash(const void *a)
 {
   HDF *ha = (HDF *)a;
-  return ne_crc(ha->name, ha->name_len);
+  return ne_crc((UINT8 *)(ha->name), ha->name_len);
 }
 
 static NEOERR *_alloc_hdf (HDF **hdf, const char *name, size_t nlen, 
@@ -769,6 +769,19 @@
       if (link) hp->link = 1;
       else hp->link = 0;
     }
+    else if (hp->link) 
+    {
+      char *new_name = (char *) malloc(strlen(hp->value) + strlen(s) + 1);
+      if (new_name == NULL)
+      {
+        return nerr_raise(NERR_NOMEM, "Unable to allocate memory");
+      }
+      strcpy(new_name, hp->value);
+      strcat(new_name, s);
+      err = _set_value (hdf, new_name, value, dup, wf, link, attr, set_node);
+      free(new_name);
+      return nerr_pass(err);
+    }
     /* At this point, we're done if there is not more HDF name space to
      * traverse */
     if (s == NULL)
@@ -1327,13 +1340,28 @@
   return x;
 }
 
+char *_strndup(const char *s, int len) {
+  int x;
+  char *dup; 
+  if (s == NULL) return NULL;
+  dup = (char *) malloc(len+1);
+  if (dup == NULL) return NULL;
+  for (x = 0; x < len && s[x]; x++)
+  {
+    dup[x] = s[x];
+  }
+  dup[x] = '\0';
+  dup[len] = '\0';
+  return dup;
+}
+
 /* attributes are of the form [key1, key2, key3=value, key4="repr"] */
 static NEOERR* parse_attr(char **str, HDF_ATTR **attr)
 {
   NEOERR *err = STATUS_OK;
   char *s = *str;
-  char save = '\0';
   char *k, *v;
+  int k_l, v_l;
   STRING buf;
   char c;
   HDF_ATTR *ha, *hal = NULL;
@@ -1344,16 +1372,19 @@
   while (*s && *s != ']')
   {
     k = s;
+    k_l = 0;
     v = NULL;
-    while (*s && *s != '=' && *s != ',' && *s != ']') s++;
-    if (*s == '\0')
+    v_l = 0;
+    while (*s && isalnum(*s)) s++;
+    k_l = s-k;
+    if (*s == '\0' || k_l == 0)
     {
       _dealloc_hdf_attr(attr);
       return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str);
     }
+    SKIPWS(s);
     if (*s == '=')
     {
-      *s = '\0';
       s++;
       SKIPWS(s);
       if (*s == '"')
@@ -1408,6 +1439,7 @@
 	}
 	s++;
 	v = buf.buf;
+        v_l = buf.len;
       }
       else
       {
@@ -1418,15 +1450,11 @@
 	  _dealloc_hdf_attr(attr);
 	  return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str);
 	}
-	save = *s;
-	*s = '\0';
-	v = neos_strip(v);
+        v_l = s-v;
       }
     }
     else
     {
-      save = *s;
-      *s = '\0';
       v = "1";
     }
     ha = (HDF_ATTR*) calloc (1, sizeof(HDF_ATTR));
@@ -1437,8 +1465,11 @@
       return nerr_raise(NERR_NOMEM, "Unable to load attributes: %s", s);
     }
     if (*attr == NULL) *attr = ha;
-    ha->key = strdup(neos_strip(k));
-    ha->value = strdup(v);
+    ha->key = _strndup(k, k_l);
+    if (v) 
+      ha->value = _strndup(v, v_l);
+    else
+      ha->value = strdup("");
     if (ha->key == NULL || ha->value == NULL)
     {
       _dealloc_hdf_attr(attr);
@@ -1448,9 +1479,12 @@
     if (hal != NULL) hal->next = ha;
     hal = ha;
     string_clear(&buf);
-    if (save) *s = save;
     SKIPWS(s);
-    if (*s == ',') s++;
+    if (*s == ',') 
+    {
+      s++;
+      SKIPWS(s);
+    }
   }
   if (*s == '\0')
   {
@@ -1481,7 +1515,12 @@
     if (!strncmp(s, "#include ", 9))
     {
       if (!ignore)
-	return nerr_raise (NERR_PARSE, "[%d]: #include not supported in string parse", *line);
+      {
+        if (buf != NULL) free(buf);
+	return nerr_raise (NERR_PARSE, 
+                           "[%d]: #include not supported in string parse",
+                           *line);
+      }
     }
     else if (s[0] == '#')
     {
@@ -1492,10 +1531,13 @@
       s = neos_strip(s);
       if (strcmp(s, "}"))
       {
-	return nerr_raise(NERR_PARSE, 
+        err = nerr_raise(NERR_PARSE, 
 	    "[%d] Trailing garbage on line following }: %s", *line,
 	    buf);
+        if (buf != NULL) free(buf);
+        return err;
       }
+      if (buf != NULL) free(buf);
       return STATUS_OK;
     }
     else if (s[0])
@@ -1511,7 +1553,11 @@
 	name = neos_strip(name);
 	s++;
 	err = parse_attr(&s, &attr);
-	if (err) return nerr_pass_ctx(err, "In String %d", *line);
+	if (err)
+        {
+          if (buf != NULL) free(buf);
+          return nerr_pass_ctx(err, "In String %d", *line);
+        }
 	SKIPWS(s);
       }
       if (s[0] == '=') /* assignment */
@@ -1522,8 +1568,11 @@
 	value = neos_strip(s);
 	err = _set_value (hdf, name, value, 1, 1, 0, attr, NULL);
 	if (err != STATUS_OK)
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_pass_ctx(err, "In String %d", *line);
       }
+      }
       else if (s[0] == ':' && s[1] == '=') /* copy */
       {
 	*s = '\0';
@@ -1533,8 +1582,11 @@
 	value = hdf_get_value(hdf->top, value, "");
 	err = _set_value (hdf, name, value, 1, 1, 0, attr, NULL);
 	if (err != STATUS_OK)
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_pass_ctx(err, "In string %d", *line);
       }
+      }
       else if (s[0] == ':') /* link */
       {
 	*s = '\0';
@@ -1543,8 +1595,11 @@
 	value = neos_strip(s);
 	err = _set_value (hdf, name, value, 1, 1, 1, attr, NULL);
 	if (err != STATUS_OK)
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_pass_ctx(err, "In string %d", *line);
       }
+      }
       else if (s[0] == '{') /* deeper */
       {
 	*s = '\0';
@@ -1559,11 +1614,17 @@
 	  err = _set_value (lower, NULL, lower->value, 1, 1, 0, attr, NULL);
 	}
 	if (err != STATUS_OK) 
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_pass_ctx(err, "In string %d", *line);
+        }
 	err = _hdf_read_string (lower, str, line, ignore);
 	if (err != STATUS_OK) 
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_pass_ctx(err, "In string %d", *line);
       }
+      }
       else if (s[0] == '<' && s[1] == '<') /* multi-line assignment */
       {
 	char *m;
@@ -1577,14 +1638,21 @@
 	value = neos_strip(s);
 	l = strlen(value);
 	if (l == 0)
-	  return nerr_raise(NERR_PARSE, 
+        {
+	  err = nerr_raise(NERR_PARSE, 
 	      "[%d] No multi-assignment terminator given: %s", *line, 
 	      buf);
+          if (buf != NULL) free(buf);
+          return err;
+        }
 	m = (char *) malloc (mmax * sizeof(char));
 	if (m == NULL)
+        {
+          if (buf != NULL) free(buf);
 	  return nerr_raise(NERR_NOMEM, 
 	    "[%d] Unable to allocate memory for multi-line assignment to %s",
 	    *line, name);
+        }
 	while (_copy_line (str, m+msize, mmax-msize) != 0)
 	{
 	  if (!strncmp(value, m+msize, l) && isspace(m[msize+l]))
@@ -1598,11 +1666,14 @@
 	    mmax += 128;
 	    m = (char *) realloc (m, mmax * sizeof(char));
 	    if (m == NULL)
+            {
+              if (buf != NULL) free(buf);
 	      return nerr_raise(NERR_NOMEM, 
 		  "[%d] Unable to allocate memory for multi-line assignment to %s: size=%d",
 		  *line, name, mmax);
 	  }
 	}
+	}
 	err = _set_value (hdf, name, m, 0, 1, 0, attr, NULL);
 	if (err != STATUS_OK)
 	{
@@ -1613,8 +1684,10 @@
       }
       else
       {
-	return nerr_raise(NERR_PARSE, "[%d] Unable to parse line %s",
+	err = nerr_raise(NERR_PARSE, "[%d] Unable to parse line %s",
 	    *line, buf);
+        if (buf != NULL) free(buf);
+        return err;
       }
     }
     if (buf != NULL) free(buf);
diff -Nrub clearsilver-0.10.1/util/neo_net.c clearsilver-0.10.2/util/neo_net.c
--- clearsilver-0.10.1/util/neo_net.c	2005-06-30 17:44:25.000000000 -0700
+++ clearsilver-0.10.2/util/neo_net.c	2005-12-05 20:17:08.000000000 -0800
@@ -112,7 +112,7 @@
   NSOCK *my_sock;
   int fd;
   struct sockaddr_in client_addr;
-  int len;
+  socklen_t len;
 
   len = sizeof(struct sockaddr_in);
   while (1)
@@ -158,7 +158,7 @@
   struct timeval tv;
   fd_set fds;
   int optval;
-  int optlen;
+  socklen_t optlen;
   NSOCK *my_sock;
 
   /* FIXME: This isn't thread safe... but there's no man entry for the _r
@@ -456,14 +456,14 @@
       if (nl == NULL)
       {
 	l = sock->il - sock->ib;
-	err = string_appendn(&str, sock->ibuf + sock->ib, l);
+	err = string_appendn(&str, (char *)(sock->ibuf + sock->ib), l);
 	sock->ib += l;
 	if (err) break;
       }
       else
       {
 	l = nl - (sock->ibuf + sock->ib);
-	err = string_appendn(&str, sock->ibuf + sock->ib, l);
+	err = string_appendn(&str, (char *)(sock->ibuf + sock->ib), l);
 	sock->ib += l;
 	if (err) break;
 
@@ -521,7 +521,7 @@
 {
   NEOERR *err;
   UINT8 *data;
-  char buf[5];
+  UINT8 buf[5];
   int l;
 
   err = _ne_net_read_int(sock, &l, ':');
@@ -589,7 +589,7 @@
   return nerr_pass(_ne_net_read_int(sock, i, ','));
 }
 
-NEOERR *ne_net_write(NSOCK *sock, const UINT8 *b, int blen)
+NEOERR *ne_net_write(NSOCK *sock, const char *b, int blen)
 {
   NEOERR *err;
   int x = 0;
@@ -633,7 +633,7 @@
   return STATUS_OK;
 }
 
-NEOERR *ne_net_write_binary(NSOCK *sock, const UINT8 *b, int blen)
+NEOERR *ne_net_write_binary(NSOCK *sock, const char *b, int blen)
 {
   NEOERR *err;
   char buf[32];
diff -Nrub clearsilver-0.10.1/util/neo_net.h clearsilver-0.10.2/util/neo_net.h
--- clearsilver-0.10.1/util/neo_net.h	2005-06-30 17:44:44.000000000 -0700
+++ clearsilver-0.10.2/util/neo_net.h	2005-12-05 20:17:50.000000000 -0800
@@ -44,9 +44,9 @@
 NEOERR *ne_net_read_binary(NSOCK *sock, UINT8 **b, int *blen);
 NEOERR *ne_net_read_str_alloc(NSOCK *sock, char **s, int *len);
 NEOERR *ne_net_read_int(NSOCK *sock, int *i);
-NEOERR *ne_net_write(NSOCK *sock, const UINT8 *b, int blen);
+NEOERR *ne_net_write(NSOCK *sock, const char *b, int blen);
 NEOERR *ne_net_write_line(NSOCK *sock, const char *s);
-NEOERR *ne_net_write_binary(NSOCK *sock, const UINT8 *b, int blen);
+NEOERR *ne_net_write_binary(NSOCK *sock, const char *b, int blen);
 NEOERR *ne_net_write_str(NSOCK *sock, const char *s);
 NEOERR *ne_net_write_int(NSOCK *sock, int i);
 NEOERR *ne_net_flush(NSOCK *sock);
diff -Nrub clearsilver-0.10.1/util/neo_str.h clearsilver-0.10.2/util/neo_str.h
--- clearsilver-0.10.1/util/neo_str.h	2005-06-30 17:43:29.000000000 -0700
+++ clearsilver-0.10.2/util/neo_str.h	2005-11-30 19:25:57.000000000 -0800
@@ -39,7 +39,7 @@
 
 typedef struct _string
 {
-  UINT8 *buf;
+  char *buf;
   int len;
   int max;
 } STRING;
diff -Nrub clearsilver-0.10.1/util/regex/regex.c clearsilver-0.10.2/util/regex/regex.c
--- clearsilver-0.10.1/util/regex/regex.c	2005-06-30 11:52:10.000000000 -0700
+++ clearsilver-0.10.2/util/regex/regex.c	2005-12-02 03:15:16.000000000 -0800
@@ -27,7 +27,8 @@
 #undef	_GNU_SOURCE
 #define _GNU_SOURCE
 
-#include "../osdep.h"
+#include "cs_config.h"
+#include "util/osdep.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
diff -Nrub clearsilver-0.10.1/util/test/hdftest.c clearsilver-0.10.2/util/test/hdftest.c
--- clearsilver-0.10.1/util/test/hdftest.c	2005-06-30 18:00:18.000000000 -0700
+++ clearsilver-0.10.2/util/test/hdftest.c	2005-12-14 16:19:22.000000000 -0800
@@ -6,6 +6,13 @@
 #include "util/neo_hdf.h"
 #include "util/neo_rand.h"
 
+#define DIE_NOT_OK(err) \
+  if (err != STATUS_OK) { \
+      nerr_log_error(err); \
+      exit(-1); \
+  }
+
+
 int rand_name (char *s, int slen)
 {
   char buf[256];
@@ -50,87 +57,74 @@
   double tstart = 0;
 
   err = hdf_init(&hdf);
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
 
   err = hdf_set_value (hdf, "Beware", "1");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_value (hdf, "Beware.The", "2");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_valuef (hdf, "Beware.The.%s=%d", "Ides", 3);
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_value (hdf, "Beware.Off", "4");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_value (hdf, "Beware.The.Ides.Of", "5");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_value (hdf, "Beware.The.Butter", "6");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_attr (hdf, "Beware.The.Butter", "Lang", "en");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_attr (hdf, "Beware.The.Butter", "Lang", "1");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   err = hdf_set_attr (hdf, "Beware.The.Butter", "Lang", NULL);
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
 
   err = hdf_read_file (hdf, "test.hdf");
-  if (err != STATUS_OK) 
-  {
-    nerr_log_error(err);
-    return -1;
-  }
+  DIE_NOT_OK(err);
   hdf_dump(hdf, NULL);
 
 
   x = hdf_get_int_value (hdf, "Beware.The.Ides", 0);
-  if (err != STATUS_OK) 
+  if (x != 3)
   {
-    nerr_log_error(err);
+    ne_warn("hdf_get_int_value returned %d, expected 3", x);
     return -1;
   }
-  if (x != 3)
+
+  /* test symlinks */
   {
-    ne_warn("hdf_get_int_value returned %d, expected 3", x);
+    const char *v;
+    err = hdf_set_value(hdf, "Destination.Foo", "bar");
+    DIE_NOT_OK(err);
+    err = hdf_set_symlink(hdf, "Symlink.baz", "Destination.Foo");
+    DIE_NOT_OK(err);
+    v = hdf_get_value(hdf, "Symlink.baz", "notfound");
+    if (strcmp(v, "bar")) {
+      ne_warn("hdf_get_value through symlink returned %s, expected bar", v);
+      return -1;
+    }
+    err = hdf_set_value(hdf, "Symlink.baz", "newvalue");
+    DIE_NOT_OK(err);
+    v = hdf_get_value(hdf, "Symlink.baz", "notfound");
+    if (strcmp(v, "newvalue")) {
+      ne_warn("hdf_get_value through symlink returned %s, expected newvalue",
+              v);
+      return -1;
+    }
+    err = hdf_set_value(hdf, "Symlink.baz.too", "newtoo");
+    DIE_NOT_OK(err);
+    v = hdf_get_value(hdf, "Symlink.baz.too", "newtoo");
+    if (strcmp(v, "newtoo")) {
+      ne_warn("hdf_get_value through symlink returned %s, expected newtoo",
+              v);
+      return -1;
+    }
+    v = hdf_get_value(hdf, "Destination.Foo.too", "newtoo");
+    if (strcmp(v, "newtoo")) {
+      ne_warn("hdf_get_value through symlink returned %s, expected newtoo",
+              v);
     return -1;
   } 
+  }
 
   for (x = 0; x < 10000; x++)
   {
@@ -138,11 +132,7 @@
     neo_rand_word(value, sizeof(value));
     /* ne_warn("Setting %s = %s", name, value); */
     err = hdf_set_value (hdf, name, value);
-    if (err != STATUS_OK) 
-    {
-      nerr_log_error(err);
-      return -1;
-    }
+    DIE_NOT_OK(err);
   }
 
   tstart = ne_timef();
