Update of /cvsroot/monetdb/MonetDB/src/common
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19592
Modified Files:
Tag: MonetDB_1-20
monet_options.mx
Log Message:
On Windows, not only substitute ${prefix} and ${exec_prefix}, but also
%prefix% and %exec_prefix%.
Index: monet_options.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/common/monet_options.mx,v
retrieving revision 1.18
retrieving revision 1.18.6.1
diff -u -d -r1.18 -r1.18.6.1
--- monet_options.mx 27 Apr 2007 09:45:09 -0000 1.18
+++ monet_options.mx 5 Oct 2007 11:28:25 -0000 1.18.6.1
@@ -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 - 14 + strlen(p)));
+ *q = 0;
+ snprintf(t, n, "%s%s%s", s, p, q + 14);
+ 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 - 9 + strlen(p)));
+ *q = 0;
+ snprintf(t, n, "%s%s%s", s, p, q + 9);
+ 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