From 93b45edf3097d061c3dd15837fb5b6091328aadf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 14 Nov 2007 20:18:46 +0000 Subject: [PATCH] add tag git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6258 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_xml.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/switch_xml.cpp b/src/switch_xml.cpp index 816e259314..3b74549f50 100644 --- a/src/switch_xml.cpp +++ b/src/switch_xml.cpp @@ -983,6 +983,7 @@ static int preprocess(const char *file, int write_fd, int rlevel) int read_fd = -1; switch_size_t cur = 0, ml = 0; char *q, *cmd, buf[2048], ebuf[8192]; + const char *tcmd, *targ; if ((read_fd = open(file, O_RDONLY, 0)) < 0) { return read_fd; @@ -1011,6 +1012,78 @@ static int preprocess(const char *file, int write_fd, int rlevel) } } + if ((tcmd = switch_stristr(bp, ""))) { + *e += 2; + *e = '\0'; + if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n"); + } + } + + if (!(tcmd = switch_stristr(tcmd, "cmd"))) { + continue; + } + + if (!(tcmd = switch_stristr(tcmd, "="))) { + continue; + } + + if (!(tcmd = switch_stristr(tcmd, "\""))) { + continue; + } + + tcmd++; + + + if ((e = strchr(tcmd, '"'))) { + *e++ = '\0'; + } + + if (!(targ = switch_stristr(e, "data"))) { + continue; + } + + if (!(targ = switch_stristr(targ, "="))) { + continue; + } + + if (!(targ = switch_stristr(targ, "\""))) { + continue; + } + + targ++; + + if ((e = strchr(targ, '"'))) { + *e++ = '\0'; + } + + if (!strcasecmp(tcmd, "set")) { + char *name = (char *)targ; + char *val = strchr(name, '='); + + if (val) { + char *ve = val++; + while (*val && *val == ' ') { + val++; + } + *ve-- = '\0'; + while (*ve && *ve == ' ') { + *ve-- = '\0'; + } + } + + if (name && val) { + switch_core_set_variable(name, val); + } + + } else if (!strcasecmp(tcmd, "include")) { + preprocess_glob(targ, write_fd, rlevel + 1); + } + + continue; + } + if ((cmd = strstr(bp, "