#include <sys/stat.h>
#include <unistd.h>
+extern char** params;
+
char* mandshurica_parse_template(const char* data, struct ms_param param) {
char* webroot = mandshurica_get_param("HTTPRoot");
if(webroot == NULL) webroot = WEBROOT_PREFIX;
free(tmp);
}
}
+ } else if(strcmp(op, "exec") == 0) {
+ /* Kinda dangerous directive */
+ if(arg != NULL) {
+ int j;
+ for(j = 0; params[j] != NULL; j += 2) {
+ char* name = mandshurica_strcat("Config_", params[j]);
+ setenv(name, params[j + 1], 1);
+ free(name);
+ }
+ FILE* proc = popen(arg, "r");
+ char buf[513];
+ int len;
+ while(1) {
+ len = fread(buf, 1, 512, proc);
+ if(len == 0) break;
+ buf[len] = 0;
+ char* tmp = ret;
+ ret = mandshurica_strcat(tmp, buf);
+ free(tmp);
+ }
+ pclose(proc);
+ }
} else if(strcmp(op, "version") == 0) {
char* tmp = ret;
ret = mandshurica_strcat(tmp, MANDSHURICA_VERSION);