aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorcitats <citats@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-09 07:51:44 +0000
committercitats <citats@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-09 07:51:44 +0000
commit9bd61aa747cedeb161b46ca536312d8e569bfbf5 (patch)
treee02913e8cd2ec7f6236ac862e98d11dc9fd199ce /apps
parent7bfd090538d068ea86150b0a7a27d5b2bda1df39 (diff)
More ast_strlen_zero changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2930 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_directory.c9
-rwxr-xr-xapps/app_enumlookup.c5
-rwxr-xr-xapps/app_festival.c6
-rwxr-xr-xapps/app_groupcount.c7
-rwxr-xr-xapps/app_playback.c3
-rwxr-xr-xapps/app_queue.c14
-rwxr-xr-xapps/app_read.c14
-rwxr-xr-xapps/app_senddtmf.c3
-rwxr-xr-xapps/app_setcdruserfield.c6
-rwxr-xr-xapps/app_setcidname.c9
-rwxr-xr-xapps/app_setcidnum.c9
11 files changed, 45 insertions, 40 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 8f0de9236..b267559ba 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -19,6 +19,7 @@
#include <asterisk/module.h>
#include <asterisk/config.h>
#include <asterisk/say.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
@@ -132,7 +133,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
char *start, *pos, *conv,*stringp=NULL;
char fn[256];
char fn2[256];
- if (!context || !strlen(context)) {
+ if (!context || ast_strlen_zero(context)) {
ast_log(LOG_WARNING, "Directory must be called with an argument (context in which to interpret extensions)\n");
return -1;
}
@@ -190,7 +191,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan);
} else {
- res = ast_say_character_str(chan, strlen(name) ? name : v->name, AST_DIGIT_ANY, chan->language);
+ res = ast_say_character_str(chan, !ast_strlen_zero(name) ? name : v->name, AST_DIGIT_ANY, chan->language);
}
ahem:
if (!res)
@@ -260,9 +261,9 @@ top:
} else
dialcontext = context;
dirintro = ast_variable_retrieve(cfg, context, "directoryintro");
- if (!dirintro || !strlen(dirintro))
+ if (!dirintro || ast_strlen_zero(dirintro))
dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
- if (!dirintro || !strlen(dirintro))
+ if (!dirintro || ast_strlen_zero(dirintro))
dirintro = "dir-intro";
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
diff --git a/apps/app_enumlookup.c b/apps/app_enumlookup.c
index c03eb97ac..148477e99 100755
--- a/apps/app_enumlookup.c
+++ b/apps/app_enumlookup.c
@@ -20,6 +20,7 @@
#include <asterisk/config.h>
#include <asterisk/module.h>
#include <asterisk/enum.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -64,7 +65,7 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
char tmp[256];
char *c,*t;
struct localuser *u;
- if (!data || !strlen(data)) {
+ if (!data || ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "EnumLookup requires an argument (extension)\n");
res = 1;
}
@@ -128,7 +129,7 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
else
res = 0;
}
- } else if (strlen(tech)) {
+ } else if (!ast_strlen_zero(tech)) {
ast_log(LOG_NOTICE, "Don't know how to handle technology '%s'\n", tech);
res = 0;
}
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 99b6226a0..3076d9a42 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -19,6 +19,7 @@
#include <asterisk/module.h>
#include <asterisk/md5.h>
#include <asterisk/config.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -304,10 +305,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
}
-
-
-
- if (!vdata || !strlen(vdata)) {
+ if (!vdata || ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "festival requires an argument (text)\n");
return -1;
}
diff --git a/apps/app_groupcount.c b/apps/app_groupcount.c
index 778a1399b..ef7b92cd9 100755
--- a/apps/app_groupcount.c
+++ b/apps/app_groupcount.c
@@ -21,6 +21,7 @@
#include <asterisk/channel.h>
#include <asterisk/pbx.h>
#include <asterisk/module.h>
+#include <asterisk/utils.h>
static char *tdesc = "Group Management Routines";
@@ -64,7 +65,7 @@ static int group_get_count(char *group)
struct ast_channel *chan;
int count = 0;
char *test;
- if (group && strlen(group)) {
+ if (group && !ast_strlen_zero(group)) {
chan = ast_channel_walk(NULL);
while(chan) {
test = pbx_builtin_getvar_helper(chan, "GROUP");
@@ -87,7 +88,7 @@ static int group_count_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
/* Check and parse arguments */
- if (data && strlen(data)) {
+ if (data && !ast_strlen_zero(data)) {
group = (char *)data;
} else {
group = pbx_builtin_getvar_helper(chan, "GROUP");
@@ -106,7 +107,7 @@ static int group_set_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
/* Check and parse arguments */
- if (data && strlen(data)) {
+ if (data && !ast_strlen_zero(data)) {
pbx_builtin_setvar_helper(chan, "GROUP", (char *)data);
} else
ast_log(LOG_WARNING, "GroupSet requires an argument (group name)\n");
diff --git a/apps/app_playback.c b/apps/app_playback.c
index aece3e675..b547547a0 100755
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -18,6 +18,7 @@
#include <asterisk/pbx.h>
#include <asterisk/module.h>
#include <asterisk/translate.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -52,7 +53,7 @@ static int playback_exec(struct ast_channel *chan, void *data)
int option_skip=0;
int option_noanswer = 0;
char *stringp;
- if (!data || !strlen((char *)data)) {
+ if (!data || ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
return -1;
}
diff --git a/apps/app_queue.c b/apps/app_queue.c
index a9f365dd4..7328a02b6 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -39,9 +39,10 @@
#include <asterisk/parking.h>
#include <asterisk/musiconhold.h>
#include <asterisk/cli.h>
-#include <asterisk/manager.h> /* JDG */
+#include <asterisk/manager.h>
#include <asterisk/config.h>
#include <asterisk/monitor.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
@@ -576,7 +577,7 @@ static int ring_one(struct queue_ent *qe, struct localuser *outgoing)
static int valid_exit(struct queue_ent *qe, char digit)
{
char tmp[2];
- if (!strlen(qe->context))
+ if (ast_strlen_zero(qe->context))
return 0;
tmp[0] = digit;
tmp[1] = '\0';
@@ -880,9 +881,9 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri
strncpy(queuename, qe->parent->name, sizeof(queuename) - 1);
time(&now);
cur = qe->parent->members;
- if (strlen(qe->announce))
+ if (!ast_strlen_zero(qe->announce))
announce = qe->announce;
- if (announceoverride && strlen(announceoverride))
+ if (announceoverride && !ast_strlen_zero(announceoverride))
announce = announceoverride;
while(cur) {
/* Get a technology/[device:]number pair */
@@ -1022,11 +1023,10 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri
}
/* Drop out of the queue at this point, to prepare for next caller */
leave_queue(qe);
- /* JDG: sendurl */
- if( url && strlen(url) && ast_channel_supports_html(peer) ) {
+ if( url && !ast_strlen_zero(url) && ast_channel_supports_html(peer) ) {
ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url);
ast_channel_sendurl( peer, url );
- } /* /JDG */
+ }
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "CONNECT", "%ld", (long)time(NULL) - qe->start);
strncpy(oldcontext, qe->chan->context, sizeof(oldcontext) - 1);
strncpy(oldexten, qe->chan->exten, sizeof(oldexten) - 1);
diff --git a/apps/app_read.c b/apps/app_read.c
index caf847828..3819afed1 100755
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -20,6 +20,7 @@
#include <asterisk/module.h>
#include <asterisk/translate.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -53,7 +54,7 @@ static int read_exec(struct ast_channel *chan, void *data)
char *stringp;
char *maxdigitstr;
int maxdigits=255;
- if (!data || !strlen((char *)data)) {
+ if (!data || ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "Read requires an argument (variable)\n");
return -1;
}
@@ -63,17 +64,16 @@ static int read_exec(struct ast_channel *chan, void *data)
varname = strsep(&stringp, "|");
filename = strsep(&stringp, "|");
maxdigitstr = strsep(&stringp,"|");
- if (!(filename) || (strlen(filename)==0)) filename = NULL;
- if (maxdigitstr)
- {
+ if (!(filename) || ast_strlen_zero(filename))
+ filename = NULL;
+ if (maxdigitstr) {
maxdigits = atoi(maxdigitstr);
if ((maxdigits<1) || (maxdigits>255)) {
maxdigits = 255;
- }
- else
+ } else
ast_verbose(VERBOSE_PREFIX_3 "Accepting a maximum of %i digits.\n", maxdigits);
}
- if (!(varname) || (strlen(varname)==0)) {
+ if (!(varname) || ast_strlen_zero(varname)) {
ast_log(LOG_WARNING, "Read requires an variable name\n");
return -1;
}
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c
index 58e99b21c..a8731e5dd 100755
--- a/apps/app_senddtmf.c
+++ b/apps/app_senddtmf.c
@@ -19,6 +19,7 @@
#include <asterisk/module.h>
#include <asterisk/translate.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -44,7 +45,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data)
struct localuser *u;
char *digits = data;
- if (!digits || !strlen(digits)) {
+ if (!digits || ast_strlen_zero(digits)) {
ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n");
return -1;
}
diff --git a/apps/app_setcdruserfield.c b/apps/app_setcdruserfield.c
index 7d2a5bb08..bb1bb339e 100755
--- a/apps/app_setcdruserfield.c
+++ b/apps/app_setcdruserfield.c
@@ -19,7 +19,7 @@
#include <asterisk/logger.h>
#include <asterisk/config.h>
#include <asterisk/manager.h>
-
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <string.h>
@@ -68,11 +68,11 @@ static int action_setcdruserfield(struct mansession *s, struct message *m)
char *channel = astman_get_header(m, "Channel");
char *append = astman_get_header(m, "Append");
- if (!strlen(channel)) {
+ if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No Channel specified");
return 0;
}
- if (!strlen(userfield)) {
+ if (ast_strlen_zero(userfield)) {
astman_send_error(s, m, "No UserField specified");
return 0;
}
diff --git a/apps/app_setcidname.c b/apps/app_setcidname.c
index d59044295..089d35f2f 100755
--- a/apps/app_setcidname.c
+++ b/apps/app_setcidname.c
@@ -20,6 +20,7 @@
#include <asterisk/translate.h>
#include <asterisk/image.h>
#include <asterisk/callerid.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -63,17 +64,17 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
ast_callerid_parse(oldcid, &n, &l);
n = tmp;
- if (strlen(n)) {
- if (l && strlen(l))
+ if (!ast_strlen_zero(n)) {
+ if (l && !ast_strlen_zero(l))
snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
else
strncpy(newcid, tmp, sizeof(newcid) - 1);
- } else if (l && strlen(l)) {
+ } else if (l && !ast_strlen_zero(l)) {
strncpy(newcid, l, sizeof(newcid) - 1);
}
} else
strncpy(newcid, tmp, sizeof(newcid));
- ast_set_callerid(chan, strlen(newcid) ? newcid : NULL, anitoo);
+ ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
LOCAL_USER_REMOVE(u);
return res;
}
diff --git a/apps/app_setcidnum.c b/apps/app_setcidnum.c
index 97eb9bba1..a4ded6b29 100755
--- a/apps/app_setcidnum.c
+++ b/apps/app_setcidnum.c
@@ -21,6 +21,7 @@
#include <asterisk/translate.h>
#include <asterisk/image.h>
#include <asterisk/callerid.h>
+#include <asterisk/utils.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -64,17 +65,17 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
strncpy(oldcid, chan->callerid, sizeof(oldcid) - 1);
ast_callerid_parse(oldcid, &n, &l);
l = tmp;
- if (strlen(l)) {
- if (n && strlen(n))
+ if (!ast_strlen_zero(l)) {
+ if (n && !ast_strlen_zero(n))
snprintf(newcid, sizeof(newcid), "\"%s\" <%s>", n, l);
else
strncpy(newcid, tmp, sizeof(newcid) - 1);
- } else if (n && strlen(n)) {
+ } else if (n && !ast_strlen_zero(n)) {
strncpy(newcid, n, sizeof(newcid) - 1);
}
} else
strncpy(newcid, tmp, sizeof(newcid));
- ast_set_callerid(chan, strlen(newcid) ? newcid : NULL, anitoo);
+ ast_set_callerid(chan, !ast_strlen_zero(newcid) ? newcid : NULL, anitoo);
LOCAL_USER_REMOVE(u);
return res;
}