summaryrefslogtreecommitdiff
path: root/main/cli.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-10-22 09:44:43 -0500
committerMatt Jordan <mjordan@digium.com>2015-11-20 22:00:07 -0600
commit9315a93757e2f78d5d54e9363a45bc8e1cba7f33 (patch)
treee39db8ef2a38714a596b44bb3026f7160a7eeae3 /main/cli.c
parent5ec076b3b8590aad8dbc31afa341605eec7146bd (diff)
main/cli: Use proper string methods to check existence of context/exten/app
Because the context, extension, and application are stored in stringfields, checking for them being NULL doesn't work so well. This patch uses the appropriate string library call, ast_strlen_zero, to see if there is a value in the context/exten/app values. Change-Id: Ie09623bfdf35f5a8d3b23dd596647fe3c97b9a23
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/cli.c b/main/cli.c
index b3d4cac3d..917305594 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1076,10 +1076,12 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
char locbuf[40] = "(None)";
char appdata[40] = "(None)";
- if (!cs->context && !cs->exten)
+ if (!ast_strlen_zero(cs->context) && !ast_strlen_zero(cs->exten)) {
snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", cs->exten, cs->context, cs->priority);
- if (cs->appl)
+ }
+ if (!ast_strlen_zero(cs->appl)) {
snprintf(appdata, sizeof(appdata), "%s(%s)", cs->appl, S_OR(cs->data, ""));
+ }
ast_cli(a->fd, FORMAT_STRING, cs->name, locbuf, ast_state2str(cs->state), appdata);
}
}