aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-25 14:31:29 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-25 14:31:29 +0000
commit30298a3d74d4caac701f336d9ae4e0da69328111 (patch)
tree7812c5de051df6b4d86de2879292f04ef5a98107 /main
parentb98c9fb9ade6270a0c020ed2d6747e7e6efec537 (diff)
Change space-zero to now evaluate to false, as is expected by a great many.
(Inspired by a post on the -users list) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118223 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/pbx.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/pbx.c b/main/pbx.c
index cc14ba2eb..a18d29e9a 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7959,12 +7959,14 @@ void pbx_builtin_clear_globals(void)
int pbx_checkcondition(const char *condition)
{
- if (ast_strlen_zero(condition)) /* NULL or empty strings are false */
+ int res;
+ if (ast_strlen_zero(condition)) { /* NULL or empty strings are false */
return 0;
- else if (*condition >= '0' && *condition <= '9') /* Numbers are evaluated for truth */
- return atoi(condition);
- else /* Strings are true */
+ } else if (sscanf(condition, "%d", &res) == 1) { /* Numbers are evaluated for truth */
+ return res;
+ } else { /* Strings are true */
return 1;
+ }
}
static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)