summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-09-03 15:36:13 +0000
committerMark Spencer <markster@digium.com>2004-09-03 15:36:13 +0000
commit04a944176923ea1e18f4d5b66edbaa5dd9cc5a2a (patch)
tree5b030d5befb88b1bd71ce49480cf03871e273d26 /config.c
parenta2da1f08bd6c1e4cd1d9cb5d8bba849c4b141d7c (diff)
Fix escaping ; (bug #2368)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'config.c')
-rwxr-xr-xconfig.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/config.c b/config.c
index a0e290305..41c53b6b6 100755
--- a/config.c
+++ b/config.c
@@ -455,13 +455,19 @@ static int cfg_process(struct ast_config *tmp, struct ast_category **_tmpc, stru
int object;
/* Strip off lines using ; as comment */
c = strchr(buf, ';');
- if (c) {
- *c = '\0';
+ while (c) {
+ if ((c == buf) || (*(c-1) != '\\')) {
+ *c = '\0';
#ifdef PRESERVE_COMMENTS
- c++;
- if (*c != '!')
- com = build_comment(c);
+ c++;
+ if (*c != '!')
+ com = build_comment(c);
#endif
+ } else {
+ *(c-1) = ';';
+ memmove(c, c + 1, strlen(c + 1));
+ }
+ c = strchr(c + 1, ';');
}
cur = strip(buf);
if (!ast_strlen_zero(cur)) {