Update of /cvsroot/monetdb/MonetDB/src/common
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15845/src/common

Modified Files:
        monet_options.mx monet_options.py.in 
Log Message:
propagated changes of Wednesday Oct 03 2007 - Monday Oct 08 2007
from the MonetDB_1-20 branch to the development trunk


Index: monet_options.py.in
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/common/monet_options.py.in,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- monet_options.py.in 18 Aug 2007 22:48:09 -0000      1.32
+++ monet_options.py.in 8 Oct 2007 09:24:36 -0000       1.33
@@ -63,12 +63,17 @@
             changed = False
             for var in 'prefix', 'exec_prefix':
                 dvar = '${%s}' % var
-                if string.find(val, dvar) < 0:
-                    # variable does not occur, skip further processing
-                    continue
-                # replace variable with its value (recursive call)
-                val = string.replace(val, dvar, self.get(var))
-                changed = True
+                if string.find(val, dvar) >= 0:
+                    # replace variable with its value (recursive call)
+                    val = string.replace(val, dvar, self.get(var))
+                    changed = True
+                if os.name == 'nt':
+                    # on Windows, also replace %prefix% and %exec_prefix%
+                    dvar = '%%%s%%' % var
+                    if string.find(val, dvar) >= 0:
+                        # replace variable with its value (recursive call)
+                        val = string.replace(val, dvar, self.get(var))
+                        changed = True
         return val
 
 class SystemOptions(BuiltinOptions):

Index: monet_options.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/common/monet_options.mx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- monet_options.mx    27 Apr 2007 09:45:09 -0000      1.18
+++ monet_options.mx    8 Oct 2007 09:24:36 -0000       1.19
@@ -63,6 +63,10 @@
 /* the option values can contain ${prefix} and ${exec_prefix}, these
    will be substituted using the mo_substitute function.  The return
    value is a newly allocated buffer, it is the caller's responsibility to 
free the buffer. */
+#ifdef WIN32
+/* on Windows, the option values can also contain %prefix% and
+   %exec_prefix% which will be substituted as well. */
+#endif
 mutils_export char *mo_substitute(opt *set, int setlen, char *name);
 
 /* mo_system_config will add the options from the system config file
@@ -208,6 +212,37 @@
                } else
                        q++;
        }
+#ifdef WIN32
+       q = s;
+       while ((q = strchr(q, '%')) != NULL) {
+               if (strncmp(q, "%exec_prefix%",  13) == 0) {
+                       char *p = mo_find_option(set, setlen, "exec_prefix");
+                       char *t;
+
+                       if (!p)
+                               return s;
+                       t = malloc((n = n - 13 + strlen(p)));
+                       *q = 0;
+                       snprintf(t, n, "%s%s%s", s, p, q + 13);
+                       free(s);
+                       q = t + (q-s);
+                       s = t;
+               } else if (strncmp(q, "%prefix%", 8) == 0) {
+                       char *p = mo_find_option(set, setlen, "prefix");
+                       char *t;
+
+                       if (!p)
+                               return s;
+                       t = malloc((n = n - 8 + strlen(p)));
+                       *q = 0;
+                       snprintf(t, n, "%s%s%s", s, p, q + 8);
+                       free(s);
+                       q = t + (q-s);
+                       s = t;
+               } else
+                       q++;
+       }
+#endif
        return s;
 }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to