#include <asterisk/rtp.h>
#include <asterisk/app.h>
#include <asterisk/lock.h>
+#include <asterisk/utils.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <stdio.h>
if (option_console || option_remote) {
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
- if (strlen(filename))
+ if (!ast_strlen_zero(filename))
ast_el_write_history(filename);
if (el != NULL)
el_end(el);
printf(term_end());
fflush(stdout);
/* Called when readline data is available */
- if (s && strlen(s))
+ if (s && !ast_strlen_zero(s))
ast_el_add_history(s);
/* Give the console access to the shell */
if (s) {
{
int ret = 0;
/* Called when readline data is available */
- if (s && strlen(s))
+ if (s && !ast_strlen_zero(s))
ast_el_add_history(s);
/* Give the console access to the shell */
if (s) {
el_set(el, EL_GETCFN, ast_el_read_char);
- if (strlen(filename))
+ if (!ast_strlen_zero(filename))
ast_el_read_history(filename);
ast_cli_register(&quit);
for(;;) {
ebuf = (char *)el_gets(el, &num);
- if (ebuf && strlen(ebuf)) {
+ if (ebuf && !ast_strlen_zero(ebuf)) {
if (ebuf[strlen(ebuf)-1] == '\n')
ebuf[strlen(ebuf)-1] = '\0';
if (!remoteconsolehandler(ebuf)) {
if (el_hist == NULL || el == NULL)
ast_el_initialize();
- if (strlen(filename))
+ if (!ast_strlen_zero(filename))
ast_el_read_history(filename);
}
#include <asterisk/config.h>
#include <asterisk/options.h>
#include <asterisk/logger.h>
+#include <asterisk/utils.h>
#include "asterisk.h"
#include "astconf.h"
{
char *start;
/* Strip off trailing whitespace, returns, etc */
- while(strlen(buf) && (buf[strlen(buf)-1]<33))
+ while(!ast_strlen_zero(buf) && (buf[strlen(buf)-1]<33))
buf[strlen(buf)-1] = '\0';
start = buf;
/* Strip off leading whitespace, returns, etc */
#endif
}
cur = strip(buf);
- if (strlen(cur)) {
+ if (!ast_strlen_zero(cur)) {
/* Actually parse the entry */
if (cur[0] == '[') {
/* A category header */
while((*c == '<') || (*c == '>') || (*c == '\"')) c++;
/* Get rid of leading mess */
cur = c;
- while(strlen(cur)) {
+ while(!ast_strlen_zero(cur)) {
c = cur + strlen(cur) - 1;
if ((*c == '>') || (*c == '<') || (*c == '\"'))
*c = '\0';
#include <asterisk/dns.h>
#include <asterisk/channel.h>
#include <asterisk/config.h>
+#include <asterisk/utils.h>
#ifdef __APPLE__
#undef T_NAPTR
return -1;
}
- if (strlen(c->dst))
+ if (!ast_strlen_zero(c->dst))
return 1;
return 0;
#include <asterisk/say.h>
#include <asterisk/lock.h>
#include <asterisk/localtime.h>
+#include <asterisk/utils.h>
#include "asterisk.h"
#include <stdio.h>
snprintf(fn, sizeof(fn), "digits/%c", fn2[num]);
}
}
- if(strlen(fn)){ /* if length == 0, then skip this digit as it is invalid */
+ if(!ast_strlen_zero(fn)){ /* if length == 0, then skip this digit as it is invalid */
res = ast_streamfile(chan, fn, lang);
if (!res)
res = ast_waitstream(chan, ints);
if ('A' <= ltr && ltr <= 'Z') ltr += 'a' - 'A'; /* file names are all lower-case */
snprintf(fn, sizeof(fn), "letters/%c", ltr);
}
- if(strlen(fn)){ /* if length == 0, then skip this digit as it is invalid */
+ if(!ast_strlen_zero(fn)) { /* if length == 0, then skip this digit as it is invalid */
res = ast_streamfile(chan, fn, lang);
if (!res)
res = ast_waitstream(chan, ints);
case ('%'):
play=0;
/* check if we have 2 chars after the % */
- if (strlen(fn2)>num+2)
+ if (strlen(fn2) > num+2)
{
hex[0]=fn2[num+1];
hex[1]=fn2[num+2];
#include <asterisk/srv.h>
#include <asterisk/dns.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#ifdef __APPLE__
#undef T_SRV
return -1;
}
- if (strlen(c->host))
+ if (!ast_strlen_zero(c->host))
return 1;
return 0;