Use ast_strlen_zero in cli.c
authorJames Golovich <james@gnuinter.net>
Thu, 6 May 2004 20:49:24 +0000 (20:49 +0000)
committerJames Golovich <james@gnuinter.net>
Thu, 6 May 2004 20:49:24 +0000 (20:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2909 65c4cc65-6c06-0410-ace0-fbb531ad65f3

cli.c

diff --git a/cli.c b/cli.c
index 80bcd73..af9aa45 100755 (executable)
--- a/cli.c
+++ b/cli.c
@@ -19,6 +19,7 @@
 #include <asterisk/module.h>
 #include <asterisk/channel.h>
 #include <asterisk/channel_pvt.h>
 #include <asterisk/module.h>
 #include <asterisk/channel.h>
 #include <asterisk/channel_pvt.h>
+#include <asterisk/utils.h>
 #include <sys/signal.h>
 #include <stdio.h>
 #include <signal.h>
 #include <sys/signal.h>
 #include <stdio.h>
 #include <signal.h>
@@ -294,7 +295,7 @@ static int handle_chanlist(int fd, int argc, char *argv[])
        ast_cli(fd, FORMAT_STRING2, "Channel", "Context", "Extension", "Pri", "State", "Appl.", "Data");
        while(c) {
                ast_cli(fd, FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
        ast_cli(fd, FORMAT_STRING2, "Channel", "Context", "Extension", "Pri", "State", "Appl.", "Data");
        while(c) {
                ast_cli(fd, FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
-               c->appl ? c->appl : "(None)", c->data ? ( strlen(c->data) ? c->data : "(Empty)" ): "(None)");
+               c->appl ? c->appl : "(None)", c->data ? ( !ast_strlen_zero(c->data) ? c->data : "(Empty)" ): "(None)");
                numchans++;
                c = ast_channel_walk(c);
        }
                numchans++;
                c = ast_channel_walk(c);
        }
@@ -516,7 +517,7 @@ static int handle_showchan(int fd, int argc, char *argv[])
        c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "",
        c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
        c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
        c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "",
        c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
        c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
-       ( c-> data ? (strlen(c->data) ? c->data : "(Empty)") : "(None)"),
+       ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
        c->stack, (c->blocking ? c->blockproc : "(Not Blocking)"));
        
                break;
        c->stack, (c->blocking ? c->blockproc : "(Not Blocking)"));
        
                break;
@@ -964,7 +965,7 @@ static char *__ast_cli_generator(char *text, char *word, int state, int lock)
                                matchnum++;
                                if (matchnum > state) {
                                        /* Now, what we're supposed to return is the next word... */
                                matchnum++;
                                if (matchnum > state) {
                                        /* Now, what we're supposed to return is the next word... */
-                                       if (strlen(word) && x>0) {
+                                       if (!ast_strlen_zero(word) && x>0) {
                                                res = e->cmda[x-1];
                                        } else {
                                                res = e->cmda[x];
                                                res = e->cmda[x-1];
                                        } else {
                                                res = e->cmda[x];