diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-03 03:01:31 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-03 03:01:31 +0000 |
commit | f18daad6e508fd7373fbdf42842ba53c23fe7dee (patch) | |
tree | 992e77d317e587c5868f4dc2b1f762fe4bf4a7aa /funcs/func_logic.c | |
parent | 9c744bc79911ba6e28bad1f70805a3cb701066c6 (diff) |
Merged revisions 81415 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r81415 | tilghman | 2007-08-31 14:16:52 -0500 (Fri, 31 Aug 2007) | 2 lines
The IF() function was not allowing true values that had embedded colons (closes issue #10613)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@81431 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_logic.c')
-rw-r--r-- | funcs/func_logic.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/funcs/func_logic.c b/funcs/func_logic.c index 92c4f8b17..4ab9ed463 100644 --- a/funcs/func_logic.c +++ b/funcs/func_logic.c @@ -93,27 +93,30 @@ static int iftime(struct ast_channel *chan, const char *cmd, char *data, char *b static int acf_if(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { - char *expr; - char *iftrue; - char *iffalse; + AST_DECLARE_APP_ARGS(args1, + AST_APP_ARG(expr); + AST_APP_ARG(remainder); + ); + AST_DECLARE_APP_ARGS(args2, + AST_APP_ARG(iftrue); + AST_APP_ARG(iffalse); + ); - data = ast_strip_quoted(data, "\"", "\""); - expr = strsep(&data, "?"); - iftrue = strsep(&data, ":"); - iffalse = data; + AST_NONSTANDARD_APP_ARGS(args1, data, '?'); + AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':'); - if (ast_strlen_zero(expr) || !(iftrue || iffalse)) { + if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) { ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n"); return -1; } - expr = ast_strip(expr); - if (iftrue) - iftrue = ast_strip_quoted(iftrue, "\"", "\""); - if (iffalse) - iffalse = ast_strip_quoted(iffalse, "\"", "\""); + args1.expr = ast_strip(args1.expr); + if (args2.iftrue) + args2.iftrue = ast_strip(args2.iftrue); + if (args2.iffalse) + args2.iffalse = ast_strip(args2.iffalse); - ast_copy_string(buf, pbx_checkcondition(expr) ? (S_OR(iftrue, "")) : (S_OR(iffalse, "")), len); + ast_copy_string(buf, pbx_checkcondition(args1.expr) ? (S_OR(args2.iftrue, "")) : (S_OR(args2.iffalse, "")), len); return 0; } |