mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
utils: Remove trailing whitespace
Change-Id: I4644f43a6a1ca9b5130cd2a6746772b888eb4f7a
This commit is contained in:
@@ -48,7 +48,7 @@ struct namelist
|
|||||||
struct namelist *next;
|
struct namelist *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ast_context
|
struct ast_context
|
||||||
{
|
{
|
||||||
int extension_count;
|
int extension_count;
|
||||||
char name[100];
|
char name[100];
|
||||||
@@ -136,7 +136,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
{
|
{
|
||||||
va_list vars;
|
va_list vars;
|
||||||
va_start(vars,fmt);
|
va_start(vars,fmt);
|
||||||
|
|
||||||
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
||||||
level, file, line, function);
|
level, file, line, function);
|
||||||
vprintf(fmt, vars);
|
vprintf(fmt, vars);
|
||||||
@@ -147,21 +147,21 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
||||||
struct ast_context *bypass,
|
struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action);
|
enum ext_match_t action);
|
||||||
|
|
||||||
struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
||||||
struct ast_context *bypass,
|
struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action)
|
enum ext_match_t action)
|
||||||
{
|
{
|
||||||
return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
|
return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
|
||||||
@@ -218,7 +218,7 @@ void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char
|
|||||||
void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count)
|
void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count)
|
||||||
{
|
{
|
||||||
if (cp1 && *cp1)
|
if (cp1 && *cp1)
|
||||||
strncpy(cp2,cp1,AST_MAX_EXTENSION); /* Right now, this routine is ONLY being called for
|
strncpy(cp2,cp1,AST_MAX_EXTENSION); /* Right now, this routine is ONLY being called for
|
||||||
a possible var substitution on extension names,
|
a possible var substitution on extension names,
|
||||||
so....! */
|
so....! */
|
||||||
else
|
else
|
||||||
@@ -255,15 +255,15 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
|
|
||||||
if( FIRST_TIME ) {
|
if( FIRST_TIME ) {
|
||||||
FIRST_TIME = 0;
|
FIRST_TIME = 0;
|
||||||
|
|
||||||
if( globalvars )
|
if( globalvars )
|
||||||
fprintf(dumpfile,"[globals]\n");
|
fprintf(dumpfile,"[globals]\n");
|
||||||
|
|
||||||
for(n=globalvars;n;n=n->next) {
|
for(n=globalvars;n;n=n->next) {
|
||||||
fprintf(dumpfile, "%s\n", n->name);
|
fprintf(dumpfile, "%s\n", n->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print out each extension , possibly the context header also */
|
/* print out each extension , possibly the context header also */
|
||||||
if( con != last_context ) {
|
if( con != last_context ) {
|
||||||
fprintf(dumpfile,"\n\n[%s]\n", con->name);
|
fprintf(dumpfile,"\n\n[%s]\n", con->name);
|
||||||
@@ -280,7 +280,7 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
for(n=con->eswitches;n;n=n->next) {
|
for(n=con->eswitches;n;n=n->next) {
|
||||||
fprintf(dumpfile, "eswitch => %s/%s\n", n->name, n->name2);
|
fprintf(dumpfile, "eswitch => %s/%s\n", n->name, n->name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if( data ) {
|
if( data ) {
|
||||||
filter_newlines((char*)data);
|
filter_newlines((char*)data);
|
||||||
@@ -303,7 +303,7 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
fprintf(dumpfile,"exten => %s,%d,%s\n", extension, priority, application);
|
fprintf(dumpfile,"exten => %s,%d,%s\n", extension, priority, application);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* since add_extension2 is responsible for the malloc'd data stuff */
|
/* since add_extension2 is responsible for the malloc'd data stuff */
|
||||||
free(data);
|
free(data);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -320,7 +320,7 @@ void pbx_builtin_setvar(void *chan, void *data)
|
|||||||
ADD_LAST(globalvars,x);
|
ADD_LAST(globalvars,x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar)
|
struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar)
|
||||||
{
|
{
|
||||||
@@ -458,7 +458,7 @@ void filter_leading_space_from_exprs(char *str)
|
|||||||
{
|
{
|
||||||
/* Mainly for aesthetics */
|
/* Mainly for aesthetics */
|
||||||
char *t, *v, *u = str;
|
char *t, *v, *u = str;
|
||||||
|
|
||||||
while ( u && *u ) {
|
while ( u && *u ) {
|
||||||
|
|
||||||
if( *u == '$' && *(u+1) == '[' ) {
|
if( *u == '$' && *(u+1) == '[' ) {
|
||||||
@@ -471,7 +471,7 @@ void filter_leading_space_from_exprs(char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u++;
|
u++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ int main(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
struct namelist *n;
|
struct namelist *n;
|
||||||
struct ast_context *lp,*lp2;
|
struct ast_context *lp,*lp2;
|
||||||
|
|
||||||
for(i=1;i<argc;i++) {
|
for(i=1;i<argc;i++) {
|
||||||
if( argv[i][0] == '-' && argv[i][1] == 'n' )
|
if( argv[i][0] == '-' && argv[i][1] == 'n' )
|
||||||
no_comp =1;
|
no_comp =1;
|
||||||
@@ -513,7 +513,7 @@ int main(int argc, char **argv)
|
|||||||
if( argv[i][0] == '-' && argv[i][1] == 'w' )
|
if( argv[i][0] == '-' && argv[i][1] == 'w' )
|
||||||
dump_extensions =1;
|
dump_extensions =1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !quiet ) {
|
if( !quiet ) {
|
||||||
printf("\n(If you find progress and other non-error messages irritating, you can use -q to suppress them)\n");
|
printf("\n(If you find progress and other non-error messages irritating, you can use -q to suppress them)\n");
|
||||||
if( !no_comp )
|
if( !no_comp )
|
||||||
@@ -533,30 +533,30 @@ int main(int argc, char **argv)
|
|||||||
localized_use_conf_dir();
|
localized_use_conf_dir();
|
||||||
}
|
}
|
||||||
strcpy(var_dir, "/var/lib/asterisk");
|
strcpy(var_dir, "/var/lib/asterisk");
|
||||||
|
|
||||||
if( dump_extensions ) {
|
if( dump_extensions ) {
|
||||||
dumpfile = fopen("extensions.conf.aeldump","w");
|
dumpfile = fopen("extensions.conf.aeldump","w");
|
||||||
if( !dumpfile ) {
|
if( !dumpfile ) {
|
||||||
printf("\n\nSorry, cannot open extensions.conf.aeldump for writing! Correct the situation and try again!\n\n");
|
printf("\n\nSorry, cannot open extensions.conf.aeldump for writing! Correct the situation and try again!\n\n");
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FIRST_TIME = 1;
|
FIRST_TIME = 1;
|
||||||
|
|
||||||
ael_external_load_module();
|
ael_external_load_module();
|
||||||
|
|
||||||
ast_log(4, "ael2_parse", __LINE__, "main", "%d contexts, %d extensions, %d priorities\n", conts, extens, priors);
|
ast_log(4, "ael2_parse", __LINE__, "main", "%d contexts, %d extensions, %d priorities\n", conts, extens, priors);
|
||||||
|
|
||||||
if( dump_extensions && dumpfile ) {
|
if( dump_extensions && dumpfile ) {
|
||||||
|
|
||||||
for( lp = context_list; lp; lp = lp->next ) { /* print out any contexts that didn't have any
|
for( lp = context_list; lp; lp = lp->next ) { /* print out any contexts that didn't have any
|
||||||
extensions in them */
|
extensions in them */
|
||||||
if( lp->extension_count == 0 ) {
|
if( lp->extension_count == 0 ) {
|
||||||
|
|
||||||
fprintf(dumpfile,"\n\n[%s]\n", lp->name);
|
fprintf(dumpfile,"\n\n[%s]\n", lp->name);
|
||||||
|
|
||||||
for(n=lp->ignorepats;n;n=n->next) {
|
for(n=lp->ignorepats;n;n=n->next) {
|
||||||
fprintf(dumpfile, "ignorepat => %s\n", n->name);
|
fprintf(dumpfile, "ignorepat => %s\n", n->name);
|
||||||
}
|
}
|
||||||
@@ -572,10 +572,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dump_extensions && dumpfile )
|
if( dump_extensions && dumpfile )
|
||||||
fclose(dumpfile);
|
fclose(dumpfile);
|
||||||
|
|
||||||
for( lp = context_list; lp; lp = lp2 ) { /* free the ast_context structs */
|
for( lp = context_list; lp; lp = lp2 ) { /* free the ast_context structs */
|
||||||
lp2 = lp->next;
|
lp2 = lp->next;
|
||||||
lp->next = 0;
|
lp->next = 0;
|
||||||
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
free(lp);
|
free(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,8 +55,8 @@ ASTERISK_REGISTER_FILE()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 2005.05.27 - different versions of newt define the type of the buffer
|
* 2005.05.27 - different versions of newt define the type of the buffer
|
||||||
* for the 5th argument to newtEntry() as char ** or const char ** . To
|
* for the 5th argument to newtEntry() as char ** or const char ** . To
|
||||||
* let the code compile cleanly with -Werror, we cast it to void * through
|
* let the code compile cleanly with -Werror, we cast it to void * through
|
||||||
* _NEWT_CAST.
|
* _NEWT_CAST.
|
||||||
*/
|
*/
|
||||||
#define _NEWT_CAST (void *)
|
#define _NEWT_CAST (void *)
|
||||||
@@ -280,7 +280,7 @@ static int process_message(struct ast_mansession *s, struct message *m)
|
|||||||
for (x=0;x<m->hdrcount;x++) {
|
for (x=0;x<m->hdrcount;x++) {
|
||||||
printf("Header: %s\n", m->headers[x]);
|
printf("Header: %s\n", m->headers[x]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,8 +295,8 @@ static void rebuild_channels(newtComponent c)
|
|||||||
newtListboxClear(c);
|
newtListboxClear(c);
|
||||||
AST_LIST_TRAVERSE(&chans, chan, list) {
|
AST_LIST_TRAVERSE(&chans, chan, list) {
|
||||||
snprintf(tmpn, sizeof(tmpn), "%s (%s)", chan->name, chan->callerid);
|
snprintf(tmpn, sizeof(tmpn), "%s (%s)", chan->name, chan->callerid);
|
||||||
if (strlen(chan->exten))
|
if (strlen(chan->exten))
|
||||||
snprintf(tmp, sizeof(tmp), "%-30s %8s -> %s@%s:%s",
|
snprintf(tmp, sizeof(tmp), "%-30s %8s -> %s@%s:%s",
|
||||||
tmpn, chan->state,
|
tmpn, chan->state,
|
||||||
chan->exten, chan->context, chan->priority);
|
chan->exten, chan->context, chan->priority);
|
||||||
else
|
else
|
||||||
@@ -313,8 +313,8 @@ static void rebuild_channels(newtComponent c)
|
|||||||
static int has_input(struct ast_mansession *s)
|
static int has_input(struct ast_mansession *s)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
for (x=1;x<s->inlen;x++)
|
for (x=1;x<s->inlen;x++)
|
||||||
if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r'))
|
if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r'))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ static int get_input(struct ast_mansession *s, char *output)
|
|||||||
s->inlen -= (x + 1);
|
s->inlen -= (x + 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s->inlen >= sizeof(s->inbuf) - 1) {
|
if (s->inlen >= sizeof(s->inbuf) - 1) {
|
||||||
fprintf(stderr, "Dumping long line with no return from %s: %s\n", inet_ntoa(s->sin.sin_addr), s->inbuf);
|
fprintf(stderr, "Dumping long line with no return from %s: %s\n", inet_ntoa(s->sin.sin_addr), s->inbuf);
|
||||||
s->inlen = 0;
|
s->inlen = 0;
|
||||||
@@ -489,7 +489,7 @@ static void try_status(void)
|
|||||||
show_message("Status Failed Failed", get_header(m, "Message"));
|
show_message("Status Failed Failed", get_header(m, "Message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void try_hangup(newtComponent c)
|
static void try_hangup(newtComponent c)
|
||||||
{
|
{
|
||||||
@@ -506,7 +506,7 @@ static void try_hangup(newtComponent c)
|
|||||||
show_message("Hangup Failed", get_header(m, "Message"));
|
show_message("Hangup Failed", get_header(m, "Message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_user_input(char *msg, char *buf, int buflen)
|
static int get_user_input(char *msg, char *buf, int buflen)
|
||||||
@@ -528,7 +528,7 @@ static int get_user_input(char *msg, char *buf, int buflen)
|
|||||||
newtFormAddComponents(form, inpfield, ok, cancel, NULL);
|
newtFormAddComponents(form, inpfield, ok, cancel, NULL);
|
||||||
newtFormRun(form, &es);
|
newtFormRun(form, &es);
|
||||||
strncpy(buf, input, buflen - 1);
|
strncpy(buf, input, buflen - 1);
|
||||||
if (es.u.co == ok)
|
if (es.u.co == ok)
|
||||||
res = 0;
|
res = 0;
|
||||||
else
|
else
|
||||||
res = -1;
|
res = -1;
|
||||||
@@ -550,7 +550,7 @@ static void try_redirect(newtComponent c)
|
|||||||
if (chan) {
|
if (chan) {
|
||||||
strncpy(channame, chan->name, sizeof(channame) - 1);
|
strncpy(channame, chan->name, sizeof(channame) - 1);
|
||||||
snprintf(tmp, sizeof(tmp), "Enter new extension for %s", channame);
|
snprintf(tmp, sizeof(tmp), "Enter new extension for %s", channame);
|
||||||
if (get_user_input(tmp, dest, sizeof(dest)))
|
if (get_user_input(tmp, dest, sizeof(dest)))
|
||||||
return;
|
return;
|
||||||
if ((context = strchr(dest, '@'))) {
|
if ((context = strchr(dest, '@'))) {
|
||||||
*context = '\0';
|
*context = '\0';
|
||||||
@@ -566,7 +566,7 @@ static void try_redirect(newtComponent c)
|
|||||||
show_message("Hangup Failed", get_header(m, "Message"));
|
show_message("Hangup Failed", get_header(m, "Message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int manage_calls(char *host)
|
static int manage_calls(char *host)
|
||||||
@@ -581,23 +581,23 @@ static int manage_calls(char *host)
|
|||||||
|
|
||||||
/* Mark: If there's one thing you learn from this code, it is this...
|
/* Mark: If there's one thing you learn from this code, it is this...
|
||||||
Never, ever fly Air France. Their customer service is absolutely
|
Never, ever fly Air France. Their customer service is absolutely
|
||||||
the worst. I've never heard the words "That's not my problem" as
|
the worst. I've never heard the words "That's not my problem" as
|
||||||
many times as I have from their staff -- It should, without doubt
|
many times as I have from their staff -- It should, without doubt
|
||||||
be their corporate motto if it isn't already. Don't bother giving
|
be their corporate motto if it isn't already. Don't bother giving
|
||||||
them business because you're just a pain in their side and they
|
them business because you're just a pain in their side and they
|
||||||
will be sure to let you know the first time you speak to them.
|
will be sure to let you know the first time you speak to them.
|
||||||
|
|
||||||
If you ever want to make me happy just tell me that you, too, will
|
If you ever want to make me happy just tell me that you, too, will
|
||||||
never fly Air France again either (in spite of their excellent
|
never fly Air France again either (in spite of their excellent
|
||||||
cuisine).
|
cuisine).
|
||||||
|
|
||||||
Update by oej: The merger with KLM has transferred this
|
Update by oej: The merger with KLM has transferred this
|
||||||
behaviour to KLM as well.
|
behaviour to KLM as well.
|
||||||
Don't bother giving them business either...
|
Don't bother giving them business either...
|
||||||
|
|
||||||
Only if you want to travel randomly without luggage, you
|
Only if you want to travel randomly without luggage, you
|
||||||
might pick either of them.
|
might pick either of them.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
snprintf(tmp, sizeof(tmp), "Asterisk Manager at %s", host);
|
snprintf(tmp, sizeof(tmp), "Asterisk Manager at %s", host);
|
||||||
newtCenteredWindow(74, 20, tmp);
|
newtCenteredWindow(74, 20, tmp);
|
||||||
@@ -610,7 +610,7 @@ static int manage_calls(char *host)
|
|||||||
channels = newtListbox(1,1,14, NEWT_FLAG_SCROLL);
|
channels = newtListbox(1,1,14, NEWT_FLAG_SCROLL);
|
||||||
newtFormAddComponents(form, channels, redirect, hangup, quit, NULL);
|
newtFormAddComponents(form, channels, redirect, hangup, quit, NULL);
|
||||||
newtListboxSetWidth(channels, 72);
|
newtListboxSetWidth(channels, 72);
|
||||||
|
|
||||||
show_doing("Getting Status", "Retrieving system status...");
|
show_doing("Getting Status", "Retrieving system status...");
|
||||||
try_status();
|
try_status();
|
||||||
hide_doing();
|
hide_doing();
|
||||||
@@ -654,18 +654,18 @@ static int manager_login(char *hostname)
|
|||||||
char tmp[55];
|
char tmp[55];
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
session.fd = socket(AF_INET, SOCK_STREAM, 0);
|
session.fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (session.fd < 0) {
|
if (session.fd < 0) {
|
||||||
snprintf(tmp, sizeof(tmp), "socket() failed: %s\n", strerror(errno));
|
snprintf(tmp, sizeof(tmp), "socket() failed: %s\n", strerror(errno));
|
||||||
show_message("Socket failed", tmp);
|
show_message("Socket failed", tmp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Looking up %s\n", hostname);
|
snprintf(tmp, sizeof(tmp), "Looking up %s\n", hostname);
|
||||||
show_doing("Connecting....", tmp);
|
show_doing("Connecting....", tmp);
|
||||||
|
|
||||||
|
|
||||||
hp = gethostbyname(hostname);
|
hp = gethostbyname(hostname);
|
||||||
if (!hp) {
|
if (!hp) {
|
||||||
snprintf(tmp, sizeof(tmp), "No such address: %s\n", hostname);
|
snprintf(tmp, sizeof(tmp), "No such address: %s\n", hostname);
|
||||||
@@ -685,21 +685,21 @@ static int manager_login(char *hostname)
|
|||||||
show_message("Connect Failed", tmp);
|
show_message("Connect Failed", tmp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hide_doing();
|
hide_doing();
|
||||||
|
|
||||||
login = newtButton(5, 6, "Login");
|
login = newtButton(5, 6, "Login");
|
||||||
cancel = newtButton(25, 6, "Cancel");
|
cancel = newtButton(25, 6, "Cancel");
|
||||||
newtCenteredWindow(40, 10, "Asterisk Manager Login");
|
newtCenteredWindow(40, 10, "Asterisk Manager Login");
|
||||||
snprintf(tmp, sizeof(tmp), "Host: %s", hostname);
|
snprintf(tmp, sizeof(tmp), "Host: %s", hostname);
|
||||||
label = newtLabel(4,1, tmp);
|
label = newtLabel(4,1, tmp);
|
||||||
|
|
||||||
ulabel = newtLabel(4,2,"Username:");
|
ulabel = newtLabel(4,2,"Username:");
|
||||||
plabel = newtLabel(4,3,"Password:");
|
plabel = newtLabel(4,3,"Password:");
|
||||||
|
|
||||||
username = newtEntry(14, 2, "", 20, _NEWT_CAST &user, 0);
|
username = newtEntry(14, 2, "", 20, _NEWT_CAST &user, 0);
|
||||||
password = newtEntry(14, 3, "", 20, _NEWT_CAST &pass, NEWT_FLAG_HIDDEN);
|
password = newtEntry(14, 3, "", 20, _NEWT_CAST &pass, NEWT_FLAG_HIDDEN);
|
||||||
|
|
||||||
form = newtForm(NULL, NULL, 0);
|
form = newtForm(NULL, NULL, 0);
|
||||||
newtFormAddComponents(form, username, password, login, cancel, label, ulabel, plabel,NULL);
|
newtFormAddComponents(form, username, password, login, cancel, label, ulabel, plabel,NULL);
|
||||||
newtFormRun(form, &es);
|
newtFormRun(form, &es);
|
||||||
@@ -736,7 +736,7 @@ static int manager_login(char *hostname)
|
|||||||
show_message("Login Failed", get_header(m, "Message"));
|
show_message("Login Failed", get_header(m, "Message"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
manager_action("Login",
|
manager_action("Login",
|
||||||
"Username: %s\r\n"
|
"Username: %s\r\n"
|
||||||
"Secret: %s\r\n",
|
"Secret: %s\r\n",
|
||||||
user, pass);
|
user, pass);
|
||||||
|
@@ -145,7 +145,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
{
|
{
|
||||||
va_list vars;
|
va_list vars;
|
||||||
va_start(vars,fmt);
|
va_start(vars,fmt);
|
||||||
|
|
||||||
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
||||||
level, file, line, function);
|
level, file, line, function);
|
||||||
vprintf(fmt, vars);
|
vprintf(fmt, vars);
|
||||||
@@ -162,7 +162,7 @@ void parse_file(const char *fname);
|
|||||||
void __ast_register_file(const char *file);
|
void __ast_register_file(const char *file);
|
||||||
void __ast_register_file(const char *file) { }
|
void __ast_register_file(const char *file) { }
|
||||||
#if !defined(LOW_MEMORY)
|
#if !defined(LOW_MEMORY)
|
||||||
int ast_add_profile(const char *x, uint64_t scale) { return 0;}
|
int ast_add_profile(const char *x, uint64_t scale) { return 0;}
|
||||||
#endif
|
#endif
|
||||||
int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
|
int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
|
||||||
{
|
{
|
||||||
@@ -207,7 +207,7 @@ unsigned int check_expr(char* buffer, char* error_report)
|
|||||||
unsigned int warn_found = 0;
|
unsigned int warn_found = 0;
|
||||||
|
|
||||||
error_report[0] = 0;
|
error_report[0] = 0;
|
||||||
|
|
||||||
for (cp = buffer; *cp; ++cp)
|
for (cp = buffer; *cp; ++cp)
|
||||||
{
|
{
|
||||||
switch (*cp)
|
switch (*cp)
|
||||||
@@ -223,7 +223,7 @@ unsigned int check_expr(char* buffer, char* error_report)
|
|||||||
global_lineno);
|
global_lineno);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
case '<':
|
case '<':
|
||||||
case '!':
|
case '!':
|
||||||
@@ -240,7 +240,7 @@ unsigned int check_expr(char* buffer, char* error_report)
|
|||||||
++warn_found;
|
++warn_found;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '|':
|
case '|':
|
||||||
case '&':
|
case '&':
|
||||||
case '=':
|
case '=':
|
||||||
@@ -292,13 +292,13 @@ int check_eval(char *buffer, char *error_report)
|
|||||||
if (*cp == '$' && *(cp+1) == '{') {
|
if (*cp == '$' && *(cp+1) == '{') {
|
||||||
int brack_lev = 1;
|
int brack_lev = 1;
|
||||||
char *xp= cp+2;
|
char *xp= cp+2;
|
||||||
|
|
||||||
while (*xp) {
|
while (*xp) {
|
||||||
if (*xp == '{')
|
if (*xp == '{')
|
||||||
brack_lev++;
|
brack_lev++;
|
||||||
else if (*xp == '}')
|
else if (*xp == '}')
|
||||||
brack_lev--;
|
brack_lev--;
|
||||||
|
|
||||||
if (brack_lev == 0)
|
if (brack_lev == 0)
|
||||||
break;
|
break;
|
||||||
xp++;
|
xp++;
|
||||||
@@ -306,7 +306,7 @@ int check_eval(char *buffer, char *error_report)
|
|||||||
if (*xp == '}') {
|
if (*xp == '}') {
|
||||||
char varname[200];
|
char varname[200];
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
strncpy(varname,cp+2, xp-cp-2);
|
strncpy(varname,cp+2, xp-cp-2);
|
||||||
varname[xp-cp-2] = 0;
|
varname[xp-cp-2] = 0;
|
||||||
cp = xp;
|
cp = xp;
|
||||||
@@ -358,7 +358,7 @@ void parse_file(const char *fname)
|
|||||||
int c1;
|
int c1;
|
||||||
char last_char= 0;
|
char last_char= 0;
|
||||||
char buffer[30000]; /* I sure hope no expr gets this big! */
|
char buffer[30000]; /* I sure hope no expr gets this big! */
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(stderr,"Couldn't open %s for reading... need an extensions.conf file to parse!\n",fname);
|
fprintf(stderr,"Couldn't open %s for reading... need an extensions.conf file to parse!\n",fname);
|
||||||
exit(20);
|
exit(20);
|
||||||
@@ -367,9 +367,9 @@ void parse_file(const char *fname)
|
|||||||
fprintf(stderr,"Couldn't open 'expr2_log' file for writing... please fix and re-run!\n");
|
fprintf(stderr,"Couldn't open 'expr2_log' file for writing... please fix and re-run!\n");
|
||||||
exit(21);
|
exit(21);
|
||||||
}
|
}
|
||||||
|
|
||||||
global_lineno = 1;
|
global_lineno = 1;
|
||||||
|
|
||||||
while ((c1 = fgetc(f)) != EOF) {
|
while ((c1 = fgetc(f)) != EOF) {
|
||||||
if (c1 == '\n')
|
if (c1 == '\n')
|
||||||
global_lineno++;
|
global_lineno++;
|
||||||
@@ -380,7 +380,7 @@ void parse_file(const char *fname)
|
|||||||
int bufcount = 0;
|
int bufcount = 0;
|
||||||
int retval;
|
int retval;
|
||||||
char error_report[30000];
|
char error_report[30000];
|
||||||
|
|
||||||
while ((c1 = fgetc(f)) != EOF) {
|
while ((c1 = fgetc(f)) != EOF) {
|
||||||
if (c1 == '[')
|
if (c1 == '[')
|
||||||
bracklev++;
|
bracklev++;
|
||||||
@@ -392,7 +392,7 @@ void parse_file(const char *fname)
|
|||||||
fclose(l);
|
fclose(l);
|
||||||
printf("--- ERROR --- A newline in the middle of an expression at line %d!\n", global_lineno);
|
printf("--- ERROR --- A newline in the middle of an expression at line %d!\n", global_lineno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bracklev == 0)
|
if (bracklev == 0)
|
||||||
break;
|
break;
|
||||||
buffer[bufcount++] = c1;
|
buffer[bufcount++] = c1;
|
||||||
@@ -404,18 +404,18 @@ void parse_file(const char *fname)
|
|||||||
printf("--- ERROR --- EOF reached in middle of an expression at line %d!\n", global_lineno);
|
printf("--- ERROR --- EOF reached in middle of an expression at line %d!\n", global_lineno);
|
||||||
exit(22);
|
exit(22);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[bufcount] = 0;
|
buffer[bufcount] = 0;
|
||||||
/* update stats */
|
/* update stats */
|
||||||
global_expr_tot_size += bufcount;
|
global_expr_tot_size += bufcount;
|
||||||
global_expr_count++;
|
global_expr_count++;
|
||||||
if (bufcount > global_expr_max_size)
|
if (bufcount > global_expr_max_size)
|
||||||
global_expr_max_size = bufcount;
|
global_expr_max_size = bufcount;
|
||||||
|
|
||||||
retval = check_expr(buffer, error_report); /* check_expr should bump the warning counter */
|
retval = check_expr(buffer, error_report); /* check_expr should bump the warning counter */
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
/* print error report */
|
/* print error report */
|
||||||
printf("Warning(s) at line %d, expression: $[%s]; see expr2_log file for details\n",
|
printf("Warning(s) at line %d, expression: $[%s]; see expr2_log file for details\n",
|
||||||
global_lineno, buffer);
|
global_lineno, buffer);
|
||||||
fprintf(l, "%s", error_report);
|
fprintf(l, "%s", error_report);
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ void parse_file(const char *fname)
|
|||||||
global_warn_count,
|
global_warn_count,
|
||||||
global_expr_max_size,
|
global_expr_max_size,
|
||||||
(global_expr_count) ? global_expr_tot_size/global_expr_count : 0);
|
(global_expr_count) ? global_expr_tot_size/global_expr_count : 0);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
fclose(l);
|
fclose(l);
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ int main(int argc,char **argv)
|
|||||||
{
|
{
|
||||||
int argc1;
|
int argc1;
|
||||||
char *eq;
|
char *eq;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("check_expr -- a program to look thru extensions.conf files for $[...] expressions,\n");
|
printf("check_expr -- a program to look thru extensions.conf files for $[...] expressions,\n");
|
||||||
printf(" and run them thru the parser, looking for problems\n");
|
printf(" and run them thru the parser, looking for problems\n");
|
||||||
@@ -458,7 +458,7 @@ int main(int argc,char **argv)
|
|||||||
printf(" Note that messages about operators not being surrounded by spaces is merely to alert\n");
|
printf(" Note that messages about operators not being surrounded by spaces is merely to alert\n");
|
||||||
printf(" you to possible problems where you might be expecting those operators as part of a string.\n");
|
printf(" you to possible problems where you might be expecting those operators as part of a string.\n");
|
||||||
printf(" (to include operators in a string, wrap with double quotes!)\n");
|
printf(" (to include operators in a string, wrap with double quotes!)\n");
|
||||||
|
|
||||||
exit(19);
|
exit(19);
|
||||||
}
|
}
|
||||||
global_varlist = 0;
|
global_varlist = 0;
|
||||||
@@ -470,7 +470,7 @@ int main(int argc,char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parse command args for x=y and set varz */
|
/* parse command args for x=y and set varz */
|
||||||
|
|
||||||
parse_file(argv[1]);
|
parse_file(argv[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
282
utils/extconf.c
282
utils/extconf.c
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, Digium, Inc.
|
* Copyright (C) 2006, Digium, Inc.
|
||||||
@@ -86,7 +86,7 @@ void ast_verbose(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define AST_API_MODULE 1 /* gimme the inline defs! */
|
#define AST_API_MODULE 1 /* gimme the inline defs! */
|
||||||
struct ast_channel
|
struct ast_channel
|
||||||
{
|
{
|
||||||
char x; /* basically empty! */
|
char x; /* basically empty! */
|
||||||
};
|
};
|
||||||
@@ -245,7 +245,7 @@ static void __attribute__((constructor)) init_empty_mutex(void)
|
|||||||
|
|
||||||
static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno, const char *func,
|
static inline int __ast_pthread_mutex_init_attr(const char *filename, int lineno, const char *func,
|
||||||
const char *mutex_name, ast_mutex_t *t,
|
const char *mutex_name, ast_mutex_t *t,
|
||||||
pthread_mutexattr_t *attr)
|
pthread_mutexattr_t *attr)
|
||||||
{
|
{
|
||||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||||
int canlog = strcmp(filename, "logger.c");
|
int canlog = strcmp(filename, "logger.c");
|
||||||
@@ -464,7 +464,7 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((res = pthread_mutex_unlock(&t->mutex))) {
|
if ((res = pthread_mutex_unlock(&t->mutex))) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Error releasing mutex: %s\n",
|
__ast_mutex_logger("%s line %d (%s): Error releasing mutex: %s\n",
|
||||||
filename, lineno, func, strerror(res));
|
filename, lineno, func, strerror(res));
|
||||||
DO_THREAD_CRASH;
|
DO_THREAD_CRASH;
|
||||||
}
|
}
|
||||||
@@ -505,7 +505,7 @@ static void __attribute__((constructor)) init_##mutex(void) \
|
|||||||
ast_mutex_init(&mutex); \
|
ast_mutex_init(&mutex); \
|
||||||
}
|
}
|
||||||
#else /* !AST_MUTEX_INIT_W_CONSTRUCTORS */
|
#else /* !AST_MUTEX_INIT_W_CONSTRUCTORS */
|
||||||
/* By default, use static initialization of mutexes. */
|
/* By default, use static initialization of mutexes. */
|
||||||
#define __AST_MUTEX_DEFINE(scope, mutex) \
|
#define __AST_MUTEX_DEFINE(scope, mutex) \
|
||||||
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
|
scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
|
||||||
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
|
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
|
||||||
@@ -618,7 +618,7 @@ AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
|
|||||||
{
|
{
|
||||||
__asm __volatile (
|
__asm __volatile (
|
||||||
" lock xaddl %0, %1 ; "
|
" lock xaddl %0, %1 ; "
|
||||||
: "+r" (v), /* 0 (result) */
|
: "+r" (v), /* 0 (result) */
|
||||||
"=m" (*p) /* 1 */
|
"=m" (*p) /* 1 */
|
||||||
: "m" (*p)); /* 2 */
|
: "m" (*p)); /* 2 */
|
||||||
return (v);
|
return (v);
|
||||||
@@ -864,7 +864,7 @@ char * attribute_malloc _ast_strdup(const char *str, const char *file, int linen
|
|||||||
* message in the case that the allocation fails.
|
* message in the case that the allocation fails.
|
||||||
*
|
*
|
||||||
* ast_strndup(), unlike strndup(), can safely accept a NULL argument for the
|
* ast_strndup(), unlike strndup(), can safely accept a NULL argument for the
|
||||||
* string to duplicate. If a NULL argument is provided, ast_strdup will return
|
* string to duplicate. If a NULL argument is provided, ast_strdup will return
|
||||||
* NULL without generating any kind of error log message.
|
* NULL without generating any kind of error log message.
|
||||||
*
|
*
|
||||||
* The arguments and return value are the same as strndup()
|
* The arguments and return value are the same as strndup()
|
||||||
@@ -1033,19 +1033,19 @@ static void LLB_ADD(char *str)
|
|||||||
int siz = strlen(str);
|
int siz = strlen(str);
|
||||||
if (rem < siz+1) {
|
if (rem < siz+1) {
|
||||||
lline_buffer = ast_realloc(lline_buffer, lline_buffer_size + CB_INCR + siz + 1);
|
lline_buffer = ast_realloc(lline_buffer, lline_buffer_size + CB_INCR + siz + 1);
|
||||||
if (!lline_buffer)
|
if (!lline_buffer)
|
||||||
return;
|
return;
|
||||||
lline_buffer_size += CB_INCR + siz + 1;
|
lline_buffer_size += CB_INCR + siz + 1;
|
||||||
}
|
}
|
||||||
strcat(lline_buffer,str);
|
strcat(lline_buffer,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CB_RESET(void )
|
static void CB_RESET(void )
|
||||||
{
|
{
|
||||||
comment_buffer[0] = 0;
|
comment_buffer[0] = 0;
|
||||||
lline_buffer[0] = 0;
|
lline_buffer[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Keep track of how many threads are currently trying to wait*() on
|
/*! \brief Keep track of how many threads are currently trying to wait*() on
|
||||||
* a child process */
|
* a child process */
|
||||||
static unsigned int safe_system_level = 0;
|
static unsigned int safe_system_level = 0;
|
||||||
@@ -1108,7 +1108,7 @@ int ast_safe_system(const char *s)
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
#else
|
#else
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
#ifdef HAVE_WORKING_FORK
|
#ifdef HAVE_WORKING_FORK
|
||||||
@@ -1124,7 +1124,7 @@ int ast_safe_system(const char *s)
|
|||||||
if (res > -1) {
|
if (res > -1) {
|
||||||
res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
|
res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
|
||||||
break;
|
break;
|
||||||
} else if (errno != EINTR)
|
} else if (errno != EINTR)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1141,7 +1141,7 @@ int ast_safe_system(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_comment *ALLOC_COMMENT(const char *buffer)
|
static struct ast_comment *ALLOC_COMMENT(const char *buffer)
|
||||||
{
|
{
|
||||||
struct ast_comment *x = ast_calloc(1,sizeof(struct ast_comment)+strlen(buffer)+1);
|
struct ast_comment *x = ast_calloc(1,sizeof(struct ast_comment)+strlen(buffer)+1);
|
||||||
strcpy(x->cmt, buffer);
|
strcpy(x->cmt, buffer);
|
||||||
return x;
|
return x;
|
||||||
@@ -1164,7 +1164,7 @@ static struct ast_config_engine *config_engine_list;
|
|||||||
struct ast_category {
|
struct ast_category {
|
||||||
char name[80];
|
char name[80];
|
||||||
int ignored; /*!< do not let user of the config see this category */
|
int ignored; /*!< do not let user of the config see this category */
|
||||||
int include_level;
|
int include_level;
|
||||||
char *file; /*!< the file name from whence this declaration was read */
|
char *file; /*!< the file name from whence this declaration was read */
|
||||||
int lineno;
|
int lineno;
|
||||||
struct ast_comment *precomments;
|
struct ast_comment *precomments;
|
||||||
@@ -1257,7 +1257,7 @@ char *ast_trim_blanks(char *str),
|
|||||||
|
|
||||||
if (work) {
|
if (work) {
|
||||||
work += strlen(work) - 1;
|
work += strlen(work) - 1;
|
||||||
/* It's tempting to only want to erase after we exit this loop,
|
/* It's tempting to only want to erase after we exit this loop,
|
||||||
but since ast_trim_blanks *could* receive a constant string
|
but since ast_trim_blanks *could* receive a constant string
|
||||||
(which we presumably wouldn't have to touch), we shouldn't
|
(which we presumably wouldn't have to touch), we shouldn't
|
||||||
actually set anything unless we must, and it's easier just
|
actually set anything unless we must, and it's easier just
|
||||||
@@ -1286,7 +1286,7 @@ char *ast_strip(char *s),
|
|||||||
if (s)
|
if (s)
|
||||||
ast_trim_blanks(s);
|
ast_trim_blanks(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1319,15 +1319,15 @@ void localized_ast_include_rename(struct ast_config *conf, const char *from_file
|
|||||||
|
|
||||||
static struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename);
|
static struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename);
|
||||||
|
|
||||||
static struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename)
|
static struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename)
|
||||||
{
|
{
|
||||||
struct ast_variable *variable;
|
struct ast_variable *variable;
|
||||||
int name_len = strlen(name) + 1;
|
int name_len = strlen(name) + 1;
|
||||||
|
|
||||||
if ((variable = ast_calloc(1, name_len + strlen(value) + 1 + strlen(filename) + 1 + sizeof(*variable)))) {
|
if ((variable = ast_calloc(1, name_len + strlen(value) + 1 + strlen(filename) + 1 + sizeof(*variable)))) {
|
||||||
variable->name = variable->stuff;
|
variable->name = variable->stuff;
|
||||||
variable->value = variable->stuff + name_len;
|
variable->value = variable->stuff + name_len;
|
||||||
variable->file = variable->value + strlen(value) + 1;
|
variable->file = variable->value + strlen(value) + 1;
|
||||||
strcpy(variable->name,name);
|
strcpy(variable->name,name);
|
||||||
strcpy(variable->value,value);
|
strcpy(variable->value,value);
|
||||||
strcpy(variable->file,filename);
|
strcpy(variable->file,filename);
|
||||||
@@ -1339,11 +1339,11 @@ static struct ast_variable *ast_variable_new(const char *name, const char *value
|
|||||||
static struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
|
static struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
|
||||||
{
|
{
|
||||||
/* a file should be included ONCE. Otherwise, if one of the instances is changed,
|
/* a file should be included ONCE. Otherwise, if one of the instances is changed,
|
||||||
then all be changed. -- how do we know to include it? -- Handling modified
|
then all be changed. -- how do we know to include it? -- Handling modified
|
||||||
instances is possible, I'd have
|
instances is possible, I'd have
|
||||||
to create a new master for each instance. */
|
to create a new master for each instance. */
|
||||||
struct ast_config_include *inc;
|
struct ast_config_include *inc;
|
||||||
|
|
||||||
inc = ast_include_find(conf, included_file);
|
inc = ast_include_find(conf, included_file);
|
||||||
if (inc)
|
if (inc)
|
||||||
{
|
{
|
||||||
@@ -1352,7 +1352,7 @@ static struct ast_config_include *ast_include_new(struct ast_config *conf, const
|
|||||||
ast_log(LOG_WARNING,"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
|
ast_log(LOG_WARNING,"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
|
||||||
} else
|
} else
|
||||||
*real_included_file_name = 0;
|
*real_included_file_name = 0;
|
||||||
|
|
||||||
inc = ast_calloc(1,sizeof(struct ast_config_include));
|
inc = ast_calloc(1,sizeof(struct ast_config_include));
|
||||||
inc->include_location_file = ast_strdup(from_file);
|
inc->include_location_file = ast_strdup(from_file);
|
||||||
inc->include_location_lineno = from_lineno;
|
inc->include_location_lineno = from_lineno;
|
||||||
@@ -1360,15 +1360,15 @@ static struct ast_config_include *ast_include_new(struct ast_config *conf, const
|
|||||||
inc->included_file = ast_strdup(real_included_file_name);
|
inc->included_file = ast_strdup(real_included_file_name);
|
||||||
else
|
else
|
||||||
inc->included_file = ast_strdup(included_file);
|
inc->included_file = ast_strdup(included_file);
|
||||||
|
|
||||||
inc->exec = is_exec;
|
inc->exec = is_exec;
|
||||||
if (is_exec)
|
if (is_exec)
|
||||||
inc->exec_file = ast_strdup(exec_file);
|
inc->exec_file = ast_strdup(exec_file);
|
||||||
|
|
||||||
/* attach this new struct to the conf struct */
|
/* attach this new struct to the conf struct */
|
||||||
inc->next = conf->includes;
|
inc->next = conf->includes;
|
||||||
conf->includes = inc;
|
conf->includes = inc;
|
||||||
|
|
||||||
return inc;
|
return inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1377,13 +1377,13 @@ void localized_ast_include_rename(struct ast_config *conf, const char *from_file
|
|||||||
struct ast_config_include *incl;
|
struct ast_config_include *incl;
|
||||||
struct ast_category *cat;
|
struct ast_category *cat;
|
||||||
struct ast_variable *v;
|
struct ast_variable *v;
|
||||||
|
|
||||||
int from_len = strlen(from_file);
|
int from_len = strlen(from_file);
|
||||||
int to_len = strlen(to_file);
|
int to_len = strlen(to_file);
|
||||||
|
|
||||||
if (strcmp(from_file, to_file) == 0) /* no use wasting time if the name is the same */
|
if (strcmp(from_file, to_file) == 0) /* no use wasting time if the name is the same */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* the manager code allows you to read in one config file, then
|
/* the manager code allows you to read in one config file, then
|
||||||
write it back out under a different name. But, the new arrangement
|
write it back out under a different name. But, the new arrangement
|
||||||
ties output lines to the file name. So, before you try to write
|
ties output lines to the file name. So, before you try to write
|
||||||
@@ -1392,7 +1392,7 @@ void localized_ast_include_rename(struct ast_config *conf, const char *from_file
|
|||||||
*/
|
*/
|
||||||
/* file names are on categories, includes (of course), and on variables. So,
|
/* file names are on categories, includes (of course), and on variables. So,
|
||||||
traverse all this and swap names */
|
traverse all this and swap names */
|
||||||
|
|
||||||
for (incl = conf->includes; incl; incl=incl->next) {
|
for (incl = conf->includes; incl; incl=incl->next) {
|
||||||
if (strcmp(incl->include_location_file,from_file) == 0) {
|
if (strcmp(incl->include_location_file,from_file) == 0) {
|
||||||
if (from_len >= to_len)
|
if (from_len >= to_len)
|
||||||
@@ -1523,7 +1523,7 @@ static struct ast_variable *variable_clone(const struct ast_variable *old)
|
|||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ast_variables_destroy(struct ast_variable *v)
|
static void ast_variables_destroy(struct ast_variable *v)
|
||||||
{
|
{
|
||||||
struct ast_variable *vn;
|
struct ast_variable *vn;
|
||||||
@@ -1538,7 +1538,7 @@ static void ast_variables_destroy(struct ast_variable *v)
|
|||||||
static void ast_includes_destroy(struct ast_config_include *incls)
|
static void ast_includes_destroy(struct ast_config_include *incls)
|
||||||
{
|
{
|
||||||
struct ast_config_include *incl,*inclnext;
|
struct ast_config_include *incl,*inclnext;
|
||||||
|
|
||||||
for (incl=incls; incl; incl = inclnext) {
|
for (incl=incls; incl; incl = inclnext) {
|
||||||
inclnext = incl->next;
|
inclnext = incl->next;
|
||||||
if (incl->include_location_file)
|
if (incl->include_location_file)
|
||||||
@@ -1559,7 +1559,7 @@ static void ast_config_destroy(struct ast_config *cfg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ast_includes_destroy(cfg->includes);
|
ast_includes_destroy(cfg->includes);
|
||||||
|
|
||||||
cat = cfg->root;
|
cat = cfg->root;
|
||||||
while (cat) {
|
while (cat) {
|
||||||
ast_variables_destroy(cat->root);
|
ast_variables_destroy(cat->root);
|
||||||
@@ -1695,7 +1695,7 @@ extern int ast_language_is_prefix;
|
|||||||
*/
|
*/
|
||||||
#define AST_RWLIST_RDLOCK(head) \
|
#define AST_RWLIST_RDLOCK(head) \
|
||||||
ast_rwlock_rdlock(&(head)->lock)
|
ast_rwlock_rdlock(&(head)->lock)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Attempts to unlock a read/write based list.
|
\brief Attempts to unlock a read/write based list.
|
||||||
\param head This is a pointer to the list head structure
|
\param head This is a pointer to the list head structure
|
||||||
@@ -1969,7 +1969,7 @@ struct { \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define AST_RWLIST_ENTRY AST_LIST_ENTRY
|
#define AST_RWLIST_ENTRY AST_LIST_ENTRY
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Returns the first entry contained in a list.
|
\brief Returns the first entry contained in a list.
|
||||||
\param head This is a pointer to the list head structure
|
\param head This is a pointer to the list head structure
|
||||||
@@ -2381,7 +2381,7 @@ struct ast_switch {
|
|||||||
AST_LIST_ENTRY(ast_switch) list;
|
AST_LIST_ENTRY(ast_switch) list;
|
||||||
const char *name; /*!< Name of the switch */
|
const char *name; /*!< Name of the switch */
|
||||||
const char *description; /*!< Description of the switch */
|
const char *description; /*!< Description of the switch */
|
||||||
|
|
||||||
ast_switch_f *exists;
|
ast_switch_f *exists;
|
||||||
ast_switch_f *canmatch;
|
ast_switch_f *canmatch;
|
||||||
ast_switch_f *exec;
|
ast_switch_f *exec;
|
||||||
@@ -2455,7 +2455,7 @@ static const char *ast_var_name(const struct ast_var_t *var)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* experiment 1: see if it's easier just to use existing config code
|
/* experiment 1: see if it's easier just to use existing config code
|
||||||
* to read in the extensions.conf file. In this scenario,
|
* to read in the extensions.conf file. In this scenario,
|
||||||
I have to rip/copy code from other modules, because they
|
I have to rip/copy code from other modules, because they
|
||||||
are staticly declared as-is. A solution would be to move
|
are staticly declared as-is. A solution would be to move
|
||||||
the ripped code to another location and make them available
|
the ripped code to another location and make them available
|
||||||
@@ -2467,7 +2467,7 @@ static void ast_log(int level, const char *file, int line, const char *function,
|
|||||||
{
|
{
|
||||||
va_list vars;
|
va_list vars;
|
||||||
va_start(vars,fmt);
|
va_start(vars,fmt);
|
||||||
|
|
||||||
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
||||||
level, file, line, function);
|
level, file, line, function);
|
||||||
vprintf(fmt, vars);
|
vprintf(fmt, vars);
|
||||||
@@ -2479,7 +2479,7 @@ void __attribute__((format(printf, 1, 2))) ast_verbose(const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list vars;
|
va_list vars;
|
||||||
va_start(vars,fmt);
|
va_start(vars,fmt);
|
||||||
|
|
||||||
printf("VERBOSE: ");
|
printf("VERBOSE: ");
|
||||||
vprintf(fmt, vars);
|
vprintf(fmt, vars);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@@ -2697,7 +2697,7 @@ struct ast_state_cb {
|
|||||||
/*! \brief Structure for dial plan hints
|
/*! \brief Structure for dial plan hints
|
||||||
|
|
||||||
\note Hints are pointers from an extension in the dialplan to one or
|
\note Hints are pointers from an extension in the dialplan to one or
|
||||||
more devices (tech/name)
|
more devices (tech/name)
|
||||||
- See \ref AstExtState
|
- See \ref AstExtState
|
||||||
*/
|
*/
|
||||||
struct ast_hint {
|
struct ast_hint {
|
||||||
@@ -2725,7 +2725,7 @@ AST_LIST_HEAD(store_hints, store_hint);
|
|||||||
#define STATUS_SUCCESS 5
|
#define STATUS_SUCCESS 5
|
||||||
|
|
||||||
static struct ast_var_t *ast_var_assign(const char *name, const char *value)
|
static struct ast_var_t *ast_var_assign(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
struct ast_var_t *var;
|
struct ast_var_t *var;
|
||||||
int name_len = strlen(name) + 1;
|
int name_len = strlen(name) + 1;
|
||||||
int value_len = strlen(value) + 1;
|
int value_len = strlen(value) + 1;
|
||||||
@@ -2737,10 +2737,10 @@ static struct ast_var_t *ast_var_assign(const char *name, const char *value)
|
|||||||
ast_copy_string(var->name, name, name_len);
|
ast_copy_string(var->name, name, name_len);
|
||||||
var->value = var->name + name_len;
|
var->value = var->name + name_len;
|
||||||
ast_copy_string(var->value, value, value_len);
|
ast_copy_string(var->value, value, value_len);
|
||||||
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ast_var_delete(struct ast_var_t *var)
|
static void ast_var_delete(struct ast_var_t *var)
|
||||||
{
|
{
|
||||||
free(var);
|
free(var);
|
||||||
@@ -3017,7 +3017,7 @@ static void null_datad(void *foo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Find realtime engine for realtime family */
|
/*! \brief Find realtime engine for realtime family */
|
||||||
static struct ast_config_engine *find_engine(const char *family, char *database, int dbsiz, char *table, int tabsiz)
|
static struct ast_config_engine *find_engine(const char *family, char *database, int dbsiz, char *table, int tabsiz)
|
||||||
{
|
{
|
||||||
struct ast_config_engine *eng, *ret = NULL;
|
struct ast_config_engine *eng, *ret = NULL;
|
||||||
struct ast_config_map *map;
|
struct ast_config_map *map;
|
||||||
@@ -3040,12 +3040,12 @@ static struct ast_config_engine *find_engine(const char *family, char *database,
|
|||||||
ret = eng;
|
ret = eng;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* if we found a mapping, but the engine is not available, then issue a warning */
|
/* if we found a mapping, but the engine is not available, then issue a warning */
|
||||||
if (map && !ret)
|
if (map && !ret)
|
||||||
ast_log(LOG_WARNING, "Realtime mapping for '%s' found to engine '%s', but the engine is not available\n", map->name, map->driver);
|
ast_log(LOG_WARNING, "Realtime mapping for '%s' found to engine '%s', but the engine is not available\n", map->name, map->driver);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3120,7 +3120,7 @@ static void ast_category_destroy(struct ast_category *cat)
|
|||||||
ast_variables_destroy(cat->root);
|
ast_variables_destroy(cat->root);
|
||||||
if (cat->file)
|
if (cat->file)
|
||||||
free(cat->file);
|
free(cat->file);
|
||||||
|
|
||||||
free(cat);
|
free(cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3137,7 +3137,7 @@ static struct ast_config *ast_config_internal_load(const char *filename, struct
|
|||||||
char db[256];
|
char db[256];
|
||||||
char table[256];
|
char table[256];
|
||||||
struct ast_config_engine *loader = &text_file_engine;
|
struct ast_config_engine *loader = &text_file_engine;
|
||||||
struct ast_config *result;
|
struct ast_config *result;
|
||||||
|
|
||||||
if (cfg->include_level == cfg->max_include_level) {
|
if (cfg->include_level == cfg->max_include_level) {
|
||||||
ast_log(LOG_WARNING, "Maximum Include level (%d) exceeded\n", cfg->max_include_level);
|
ast_log(LOG_WARNING, "Maximum Include level (%d) exceeded\n", cfg->max_include_level);
|
||||||
@@ -3165,7 +3165,7 @@ static struct ast_config *ast_config_internal_load(const char *filename, struct
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = loader->load_func(db, table, filename, cfg, withcomments, suggested_incl_file);
|
result = loader->load_func(db, table, filename, cfg, withcomments, suggested_incl_file);
|
||||||
/* silence is golden
|
/* silence is golden
|
||||||
ast_log(LOG_WARNING, "finished internal loading file %s level=%d\n", filename, cfg->include_level);
|
ast_log(LOG_WARNING, "finished internal loading file %s level=%d\n", filename, cfg->include_level);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -3204,7 +3204,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(*cat)->lineno = lineno;
|
(*cat)->lineno = lineno;
|
||||||
|
|
||||||
/* add comments */
|
/* add comments */
|
||||||
if (withcomments && comment_buffer && comment_buffer[0] ) {
|
if (withcomments && comment_buffer && comment_buffer[0] ) {
|
||||||
newcat->precomments = ALLOC_COMMENT(comment_buffer);
|
newcat->precomments = ALLOC_COMMENT(comment_buffer);
|
||||||
@@ -3214,7 +3214,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
}
|
}
|
||||||
if( withcomments )
|
if( withcomments )
|
||||||
CB_RESET();
|
CB_RESET();
|
||||||
|
|
||||||
/* If there are options or categories to inherit from, process them now */
|
/* If there are options or categories to inherit from, process them now */
|
||||||
if (c) {
|
if (c) {
|
||||||
if (!(cur = strchr(c, ')'))) {
|
if (!(cur = strchr(c, ')'))) {
|
||||||
@@ -3241,7 +3241,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct ast_category *base;
|
struct ast_category *base;
|
||||||
|
|
||||||
base = category_get(cfg, cur, 1);
|
base = category_get(cfg, cur, 1);
|
||||||
if (!base) {
|
if (!base) {
|
||||||
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
|
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
|
||||||
@@ -3264,7 +3264,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
c = ast_skip_blanks(c + 1);
|
c = ast_skip_blanks(c + 1);
|
||||||
if (!*c)
|
if (!*c)
|
||||||
c = NULL;
|
c = NULL;
|
||||||
} else
|
} else
|
||||||
c = NULL;
|
c = NULL;
|
||||||
do_include = !strcasecmp(cur, "include");
|
do_include = !strcasecmp(cur, "include");
|
||||||
if(!do_include)
|
if(!do_include)
|
||||||
@@ -3279,7 +3279,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
if (c) {
|
if (c) {
|
||||||
char *cur2;
|
char *cur2;
|
||||||
char real_inclusion_name[256];
|
char real_inclusion_name[256];
|
||||||
|
|
||||||
/* Strip off leading and trailing "'s and <>'s */
|
/* Strip off leading and trailing "'s and <>'s */
|
||||||
while((*c == '<') || (*c == '>') || (*c == '\"')) c++;
|
while((*c == '<') || (*c == '>') || (*c == '\"')) c++;
|
||||||
/* Get rid of leading mess */
|
/* Get rid of leading mess */
|
||||||
@@ -3294,7 +3294,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
}
|
}
|
||||||
/* #exec </path/to/executable>
|
/* #exec </path/to/executable>
|
||||||
We create a tmp file, then we #include it, then we delete it. */
|
We create a tmp file, then we #include it, then we delete it. */
|
||||||
if (do_exec) {
|
if (do_exec) {
|
||||||
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d.%ld", (int)time(NULL), (long)pthread_self());
|
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d.%ld", (int)time(NULL), (long)pthread_self());
|
||||||
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
|
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
|
||||||
ast_safe_system(cmd);
|
ast_safe_system(cmd);
|
||||||
@@ -3303,26 +3303,26 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
exec_file[0] = '\0';
|
exec_file[0] = '\0';
|
||||||
/* A #include */
|
/* A #include */
|
||||||
/* ast_log(LOG_WARNING, "Reading in included file %s withcomments=%d\n", cur, withcomments); */
|
/* ast_log(LOG_WARNING, "Reading in included file %s withcomments=%d\n", cur, withcomments); */
|
||||||
|
|
||||||
/* record this inclusion */
|
/* record this inclusion */
|
||||||
ast_include_new(cfg, configfile, cur, do_exec, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name));
|
ast_include_new(cfg, configfile, cur, do_exec, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name));
|
||||||
|
|
||||||
do_include = ast_config_internal_load(cur, cfg, withcomments, real_inclusion_name) ? 1 : 0;
|
do_include = ast_config_internal_load(cur, cfg, withcomments, real_inclusion_name) ? 1 : 0;
|
||||||
if(!ast_strlen_zero(exec_file))
|
if(!ast_strlen_zero(exec_file))
|
||||||
unlink(exec_file);
|
unlink(exec_file);
|
||||||
if(!do_include)
|
if(!do_include)
|
||||||
return 0;
|
return 0;
|
||||||
/* ast_log(LOG_WARNING, "Done reading in included file %s withcomments=%d\n", cur, withcomments); */
|
/* ast_log(LOG_WARNING, "Done reading in included file %s withcomments=%d\n", cur, withcomments); */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
|
ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
|
||||||
do_exec ? "exec" : "include",
|
do_exec ? "exec" : "include",
|
||||||
do_exec ? "/path/to/executable" : "filename",
|
do_exec ? "/path/to/executable" : "filename",
|
||||||
lineno,
|
lineno,
|
||||||
configfile);
|
configfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ast_log(LOG_WARNING, "Unknown directive '%s' at line %d of %s\n", cur, lineno, configfile);
|
ast_log(LOG_WARNING, "Unknown directive '%s' at line %d of %s\n", cur, lineno, configfile);
|
||||||
} else {
|
} else {
|
||||||
/* Just a line (variable = value) */
|
/* Just a line (variable = value) */
|
||||||
@@ -3356,7 +3356,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
}
|
}
|
||||||
if( withcomments )
|
if( withcomments )
|
||||||
CB_RESET();
|
CB_RESET();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -3394,7 +3394,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
struct ast_category *cat = NULL;
|
struct ast_category *cat = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
cat = ast_config_get_current_category(cfg);
|
cat = ast_config_get_current_category(cfg);
|
||||||
|
|
||||||
if (filename[0] == '/') {
|
if (filename[0] == '/') {
|
||||||
@@ -3409,7 +3409,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
if (withcomments && cfg && cfg->include_level < 2 ) {
|
if (withcomments && cfg && cfg->include_level < 2 ) {
|
||||||
CB_INIT();
|
CB_INIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AST_INCLUDE_GLOB
|
#ifdef AST_INCLUDE_GLOB
|
||||||
{
|
{
|
||||||
int glob_ret;
|
int glob_ret;
|
||||||
@@ -3460,17 +3460,17 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
while(!feof(f)) {
|
while(!feof(f)) {
|
||||||
lineno++;
|
lineno++;
|
||||||
if (fgets(buf, sizeof(buf), f)) {
|
if (fgets(buf, sizeof(buf), f)) {
|
||||||
if ( withcomments ) {
|
if ( withcomments ) {
|
||||||
CB_ADD(lline_buffer); /* add the current lline buffer to the comment buffer */
|
CB_ADD(lline_buffer); /* add the current lline buffer to the comment buffer */
|
||||||
lline_buffer[0] = 0; /* erase the lline buffer */
|
lline_buffer[0] = 0; /* erase the lline buffer */
|
||||||
}
|
}
|
||||||
|
|
||||||
new_buf = buf;
|
new_buf = buf;
|
||||||
if (comment)
|
if (comment)
|
||||||
process_buf = NULL;
|
process_buf = NULL;
|
||||||
else
|
else
|
||||||
process_buf = buf;
|
process_buf = buf;
|
||||||
|
|
||||||
while ((comment_p = strchr(new_buf, COMMENT_META))) {
|
while ((comment_p = strchr(new_buf, COMMENT_META))) {
|
||||||
if ((comment_p > new_buf) && (*(comment_p-1) == '\\')) {
|
if ((comment_p > new_buf) && (*(comment_p-1) == '\\')) {
|
||||||
/* Yuck, gotta memmove */
|
/* Yuck, gotta memmove */
|
||||||
@@ -3502,7 +3502,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
CB_ADD(";");
|
CB_ADD(";");
|
||||||
CB_ADD_LEN(oldptr+1,new_buf-oldptr-1);
|
CB_ADD_LEN(oldptr+1,new_buf-oldptr-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(oldptr, new_buf, strlen(new_buf) + 1);
|
memmove(oldptr, new_buf, strlen(new_buf) + 1);
|
||||||
new_buf = oldptr;
|
new_buf = oldptr;
|
||||||
} else
|
} else
|
||||||
@@ -3510,12 +3510,12 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!comment) {
|
if (!comment) {
|
||||||
/* If ; is found, and we are not nested in a comment,
|
/* If ; is found, and we are not nested in a comment,
|
||||||
we immediately stop all comment processing */
|
we immediately stop all comment processing */
|
||||||
if ( withcomments ) {
|
if ( withcomments ) {
|
||||||
LLB_ADD(comment_p);
|
LLB_ADD(comment_p);
|
||||||
}
|
}
|
||||||
*comment_p = '\0';
|
*comment_p = '\0';
|
||||||
new_buf = comment_p;
|
new_buf = comment_p;
|
||||||
} else
|
} else
|
||||||
new_buf = comment_p + 1;
|
new_buf = comment_p + 1;
|
||||||
@@ -3525,7 +3525,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
{
|
{
|
||||||
CB_ADD(buf); /* the whole line is a comment, store it */
|
CB_ADD(buf); /* the whole line is a comment, store it */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process_buf) {
|
if (process_buf) {
|
||||||
char *stripped_process_buf = ast_strip(process_buf);
|
char *stripped_process_buf = ast_strip(process_buf);
|
||||||
if (!ast_strlen_zero(stripped_process_buf)) {
|
if (!ast_strlen_zero(stripped_process_buf)) {
|
||||||
@@ -3537,7 +3537,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} while(0);
|
} while(0);
|
||||||
if (comment) {
|
if (comment) {
|
||||||
ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]);
|
ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]);
|
||||||
@@ -3551,12 +3551,12 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cfg && cfg->include_level == 1 && withcomments && comment_buffer) {
|
if (cfg && cfg->include_level == 1 && withcomments && comment_buffer) {
|
||||||
if (comment_buffer) {
|
if (comment_buffer) {
|
||||||
free(comment_buffer);
|
free(comment_buffer);
|
||||||
free(lline_buffer);
|
free(lline_buffer);
|
||||||
comment_buffer=0;
|
comment_buffer=0;
|
||||||
lline_buffer=0;
|
lline_buffer=0;
|
||||||
comment_buffer_size=0;
|
comment_buffer_size=0;
|
||||||
lline_buffer_size=0;
|
lline_buffer_size=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3569,7 +3569,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
|
|
||||||
static struct ast_config *ast_config_new(void) ;
|
static struct ast_config *ast_config_new(void) ;
|
||||||
|
|
||||||
static struct ast_config *ast_config_new(void)
|
static struct ast_config *ast_config_new(void)
|
||||||
{
|
{
|
||||||
struct ast_config *config;
|
struct ast_config *config;
|
||||||
|
|
||||||
@@ -3622,7 +3622,7 @@ static struct ast_category *next_available_category(struct ast_category *cat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *ast_category_browse(struct ast_config *config, const char *prev)
|
static char *ast_category_browse(struct ast_config *config, const char *prev)
|
||||||
{
|
{
|
||||||
struct ast_category *cat = NULL;
|
struct ast_category *cat = NULL;
|
||||||
|
|
||||||
if (prev && config->last_browse && (config->last_browse->name == prev))
|
if (prev && config->last_browse && (config->last_browse->name == prev))
|
||||||
@@ -3645,7 +3645,7 @@ static char *ast_category_browse(struct ast_config *config, const char *prev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cat)
|
if (cat)
|
||||||
cat = next_available_category(cat);
|
cat = next_available_category(cat);
|
||||||
|
|
||||||
@@ -3666,21 +3666,21 @@ void ast_config_set_current_category(struct ast_config *cfg, const struct ast_ca
|
|||||||
/* NOTE: categories and variables each have a file and lineno attribute. On a save operation, these are used to determine
|
/* NOTE: categories and variables each have a file and lineno attribute. On a save operation, these are used to determine
|
||||||
which file and line number to write out to. Thus, an entire hierarchy of config files (via #include statements) can be
|
which file and line number to write out to. Thus, an entire hierarchy of config files (via #include statements) can be
|
||||||
recreated. BUT, care must be taken to make sure that every cat and var has the proper file name stored, or you may
|
recreated. BUT, care must be taken to make sure that every cat and var has the proper file name stored, or you may
|
||||||
be shocked and mystified as to why things are not showing up in the files!
|
be shocked and mystified as to why things are not showing up in the files!
|
||||||
|
|
||||||
Also, All #include/#exec statements are recorded in the "includes" LL in the ast_config structure. The file name
|
Also, All #include/#exec statements are recorded in the "includes" LL in the ast_config structure. The file name
|
||||||
and line number are stored for each include, plus the name of the file included, so that these statements may be
|
and line number are stored for each include, plus the name of the file included, so that these statements may be
|
||||||
included in the output files on a file_save operation.
|
included in the output files on a file_save operation.
|
||||||
|
|
||||||
The lineno's are really just for relative placement in the file. There is no attempt to make sure that blank lines
|
The lineno's are really just for relative placement in the file. There is no attempt to make sure that blank lines
|
||||||
are included to keep the lineno's the same between input and output. The lineno fields are used mainly to determine
|
are included to keep the lineno's the same between input and output. The lineno fields are used mainly to determine
|
||||||
the position of the #include and #exec directives. So, blank lines tend to disappear from a read/rewrite operation,
|
the position of the #include and #exec directives. So, blank lines tend to disappear from a read/rewrite operation,
|
||||||
and a header gets added.
|
and a header gets added.
|
||||||
|
|
||||||
vars and category heads are output in the order they are stored in the config file. So, if the software
|
vars and category heads are output in the order they are stored in the config file. So, if the software
|
||||||
shuffles these at all, then the placement of #include directives might get a little mixed up, because the
|
shuffles these at all, then the placement of #include directives might get a little mixed up, because the
|
||||||
file/lineno data probably won't get changed.
|
file/lineno data probably won't get changed.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void gen_header(FILE *f1, const char *configfile, const char *fn, const char *generator)
|
static void gen_header(FILE *f1, const char *configfile, const char *fn, const char *generator)
|
||||||
@@ -3689,7 +3689,7 @@ static void gen_header(FILE *f1, const char *configfile, const char *fn, const c
|
|||||||
time_t t;
|
time_t t;
|
||||||
time(&t);
|
time(&t);
|
||||||
ast_copy_string(date, ctime(&t), sizeof(date));
|
ast_copy_string(date, ctime(&t), sizeof(date));
|
||||||
|
|
||||||
fprintf(f1, ";!\n");
|
fprintf(f1, ";!\n");
|
||||||
fprintf(f1, ";! Automatically generated configuration file\n");
|
fprintf(f1, ";! Automatically generated configuration file\n");
|
||||||
if (strcmp(configfile, fn))
|
if (strcmp(configfile, fn))
|
||||||
@@ -3708,7 +3708,7 @@ static void set_fn(char *fn, int fn_size, const char *file, const char *configfi
|
|||||||
ast_copy_string(fn, configfile, fn_size);
|
ast_copy_string(fn, configfile, fn_size);
|
||||||
else
|
else
|
||||||
snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
|
snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
|
||||||
} else if (file[0] == '/')
|
} else if (file[0] == '/')
|
||||||
ast_copy_string(fn, file, fn_size);
|
ast_copy_string(fn, file, fn_size);
|
||||||
else
|
else
|
||||||
snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, file);
|
snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, file);
|
||||||
@@ -3725,20 +3725,20 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
struct ast_comment *cmt;
|
struct ast_comment *cmt;
|
||||||
struct ast_config_include *incl;
|
struct ast_config_include *incl;
|
||||||
int blanklines = 0;
|
int blanklines = 0;
|
||||||
|
|
||||||
/* reset all the output flags, in case this isn't our first time saving this data */
|
/* reset all the output flags, in case this isn't our first time saving this data */
|
||||||
|
|
||||||
for (incl=cfg->includes; incl; incl = incl->next)
|
for (incl=cfg->includes; incl; incl = incl->next)
|
||||||
incl->output = 0;
|
incl->output = 0;
|
||||||
|
|
||||||
/* go thru all the inclusions and make sure all the files involved (configfile plus all its inclusions)
|
/* go thru all the inclusions and make sure all the files involved (configfile plus all its inclusions)
|
||||||
are all truncated to zero bytes and have that nice header*/
|
are all truncated to zero bytes and have that nice header*/
|
||||||
|
|
||||||
for (incl=cfg->includes; incl; incl = incl->next)
|
for (incl=cfg->includes; incl; incl = incl->next)
|
||||||
{
|
{
|
||||||
if (!incl->exec) { /* leave the execs alone -- we'll write out the #exec directives, but won't zero out the include files or exec files*/
|
if (!incl->exec) { /* leave the execs alone -- we'll write out the #exec directives, but won't zero out the include files or exec files*/
|
||||||
FILE *f1;
|
FILE *f1;
|
||||||
|
|
||||||
set_fn(fn, sizeof(fn), incl->included_file, configfile); /* normally, fn is just set to incl->included_file, prepended with config dir if relative */
|
set_fn(fn, sizeof(fn), incl->included_file, configfile); /* normally, fn is just set to incl->included_file, prepended with config dir if relative */
|
||||||
f1 = fopen(fn,"w");
|
f1 = fopen(fn,"w");
|
||||||
if (f1) {
|
if (f1) {
|
||||||
@@ -3749,24 +3749,24 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_fn(fn, sizeof(fn), 0, configfile); /* just set fn to absolute ver of configfile */
|
set_fn(fn, sizeof(fn), 0, configfile); /* just set fn to absolute ver of configfile */
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
if ((f = fopen(fn, "w+"))) {
|
if ((f = fopen(fn, "w+"))) {
|
||||||
#else
|
#else
|
||||||
if ((f = fopen(fn, "w"))) {
|
if ((f = fopen(fn, "w"))) {
|
||||||
#endif
|
#endif
|
||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "Saving '%s': ", fn);
|
ast_verbose(VERBOSE_PREFIX_2 "Saving '%s': ", fn);
|
||||||
|
|
||||||
gen_header(f, configfile, fn, generator);
|
gen_header(f, configfile, fn, generator);
|
||||||
cat = cfg->root;
|
cat = cfg->root;
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
/* from here out, we open each involved file and concat the stuff we need to add to the end and immediately close... */
|
/* from here out, we open each involved file and concat the stuff we need to add to the end and immediately close... */
|
||||||
/* since each var, cat, and associated comments can come from any file, we have to be
|
/* since each var, cat, and associated comments can come from any file, we have to be
|
||||||
mobile, and open each file, print, and close it on an entry-by-entry basis */
|
mobile, and open each file, print, and close it on an entry-by-entry basis */
|
||||||
|
|
||||||
while(cat) {
|
while(cat) {
|
||||||
set_fn(fn, sizeof(fn), cat->file, configfile);
|
set_fn(fn, sizeof(fn), cat->file, configfile);
|
||||||
f = fopen(fn, "a");
|
f = fopen(fn, "a");
|
||||||
@@ -3775,7 +3775,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dump any includes that happen before this category header */
|
/* dump any includes that happen before this category header */
|
||||||
for (incl=cfg->includes; incl; incl = incl->next) {
|
for (incl=cfg->includes; incl; incl = incl->next) {
|
||||||
if (strcmp(incl->include_location_file, cat->file) == 0){
|
if (strcmp(incl->include_location_file, cat->file) == 0){
|
||||||
@@ -3788,7 +3788,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump section with any appropriate comment */
|
/* Dump section with any appropriate comment */
|
||||||
for (cmt = cat->precomments; cmt; cmt=cmt->next) {
|
for (cmt = cat->precomments; cmt; cmt=cmt->next) {
|
||||||
if (cmt->cmt[0] != ';' || cmt->cmt[1] != '!')
|
if (cmt->cmt[0] != ';' || cmt->cmt[1] != '!')
|
||||||
@@ -3803,7 +3803,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
if (!cat->sameline)
|
if (!cat->sameline)
|
||||||
fprintf(f,"\n");
|
fprintf(f,"\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
var = cat->root;
|
var = cat->root;
|
||||||
while(var) {
|
while(var) {
|
||||||
set_fn(fn, sizeof(fn), var->file, configfile);
|
set_fn(fn, sizeof(fn), var->file, configfile);
|
||||||
@@ -3813,7 +3813,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dump any includes that happen before this category header */
|
/* dump any includes that happen before this category header */
|
||||||
for (incl=cfg->includes; incl; incl = incl->next) {
|
for (incl=cfg->includes; incl; incl = incl->next) {
|
||||||
if (strcmp(incl->include_location_file, var->file) == 0){
|
if (strcmp(incl->include_location_file, var->file) == 0){
|
||||||
@@ -3826,24 +3826,24 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cmt = var->precomments; cmt; cmt=cmt->next) {
|
for (cmt = var->precomments; cmt; cmt=cmt->next) {
|
||||||
if (cmt->cmt[0] != ';' || cmt->cmt[1] != '!')
|
if (cmt->cmt[0] != ';' || cmt->cmt[1] != '!')
|
||||||
fprintf(f,"%s", cmt->cmt);
|
fprintf(f,"%s", cmt->cmt);
|
||||||
}
|
}
|
||||||
if (var->sameline)
|
if (var->sameline)
|
||||||
fprintf(f, "%s %s %s %s", var->name, (var->object ? "=>" : "="), var->value, var->sameline->cmt);
|
fprintf(f, "%s %s %s %s", var->name, (var->object ? "=>" : "="), var->value, var->sameline->cmt);
|
||||||
else
|
else
|
||||||
fprintf(f, "%s %s %s\n", var->name, (var->object ? "=>" : "="), var->value);
|
fprintf(f, "%s %s %s\n", var->name, (var->object ? "=>" : "="), var->value);
|
||||||
if (var->blanklines) {
|
if (var->blanklines) {
|
||||||
blanklines = var->blanklines;
|
blanklines = var->blanklines;
|
||||||
while (blanklines--)
|
while (blanklines--)
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
|
||||||
var = var->next;
|
var = var->next;
|
||||||
}
|
}
|
||||||
cat = cat->next;
|
cat = cat->next;
|
||||||
@@ -3860,7 +3860,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
|
|
||||||
/* Now, for files with trailing #include/#exec statements,
|
/* Now, for files with trailing #include/#exec statements,
|
||||||
we have to make sure every entry is output */
|
we have to make sure every entry is output */
|
||||||
|
|
||||||
for (incl=cfg->includes; incl; incl = incl->next) {
|
for (incl=cfg->includes; incl; incl = incl->next) {
|
||||||
if (!incl->output) {
|
if (!incl->output) {
|
||||||
/* open the respective file */
|
/* open the respective file */
|
||||||
@@ -3871,7 +3871,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
ast_verbose(VERBOSE_PREFIX_2 "Unable to write %s (%s)", fn, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* output the respective include */
|
/* output the respective include */
|
||||||
if (incl->exec)
|
if (incl->exec)
|
||||||
fprintf(f,"#exec \"%s\"\n", incl->exec_file);
|
fprintf(f,"#exec \"%s\"\n", incl->exec_file);
|
||||||
@@ -3881,7 +3881,7 @@ int localized_config_text_file_save(const char *configfile, const struct ast_con
|
|||||||
incl->output = 1;
|
incl->output = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4207,7 +4207,7 @@ static int ext_cmp1(const char **p)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* locate end of set */
|
/* locate end of set */
|
||||||
end = strchr(*p, ']');
|
end = strchr(*p, ']');
|
||||||
|
|
||||||
if (end == NULL) {
|
if (end == NULL) {
|
||||||
ast_log(LOG_WARNING, "Wrong usage of [] in the extension\n");
|
ast_log(LOG_WARNING, "Wrong usage of [] in the extension\n");
|
||||||
@@ -4566,24 +4566,24 @@ static inline int include_valid(struct ast_include *i)
|
|||||||
|
|
||||||
|
|
||||||
static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
||||||
struct ast_context *bypass,
|
struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action);
|
enum ext_match_t action);
|
||||||
|
|
||||||
|
|
||||||
static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
||||||
struct ast_context *bypass,
|
struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action)
|
enum ext_match_t action)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
@@ -4667,7 +4667,7 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* No need to Substitute variables now; we shouldn't be here if there's any */
|
/* No need to Substitute variables now; we shouldn't be here if there's any */
|
||||||
|
|
||||||
/* equivalent of extension_match_core() at the switch level */
|
/* equivalent of extension_match_core() at the switch level */
|
||||||
if (action == E_CANMATCH)
|
if (action == E_CANMATCH)
|
||||||
aswf = asw->canmatch;
|
aswf = asw->canmatch;
|
||||||
@@ -4701,20 +4701,20 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
|||||||
|
|
||||||
struct ast_exten *localized_find_extension(struct ast_context *bypass,
|
struct ast_exten *localized_find_extension(struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action);
|
enum ext_match_t action);
|
||||||
|
|
||||||
struct ast_exten *localized_find_extension(struct ast_context *bypass,
|
struct ast_exten *localized_find_extension(struct ast_context *bypass,
|
||||||
struct pbx_find_info *q,
|
struct pbx_find_info *q,
|
||||||
const char *context,
|
const char *context,
|
||||||
const char *exten,
|
const char *exten,
|
||||||
int priority,
|
int priority,
|
||||||
const char *label,
|
const char *label,
|
||||||
const char *callerid,
|
const char *callerid,
|
||||||
enum ext_match_t action)
|
enum ext_match_t action)
|
||||||
{
|
{
|
||||||
return pbx_find_extension(NULL, bypass, q, context, exten, priority, label, callerid, action);
|
return pbx_find_extension(NULL, bypass, q, context, exten, priority, label, callerid, action);
|
||||||
@@ -5328,7 +5328,7 @@ static void pbx_retrieve_variable(struct ast_channel *c, const char *var, char *
|
|||||||
int offset, length;
|
int offset, length;
|
||||||
int i, need_substring;
|
int i, need_substring;
|
||||||
struct varshead *places[2] = { headp, &globals }; /* list of places where we may look */
|
struct varshead *places[2] = { headp, &globals }; /* list of places where we may look */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a copy of var because parse_variable_name() modifies the string.
|
* Make a copy of var because parse_variable_name() modifies the string.
|
||||||
* Then if called directly, we might need to run substring() on the result;
|
* Then if called directly, we might need to run substring() on the result;
|
||||||
@@ -5336,7 +5336,7 @@ static void pbx_retrieve_variable(struct ast_channel *c, const char *var, char *
|
|||||||
*/
|
*/
|
||||||
tmpvar = ast_strdupa(var); /* parse_variable_name modifies the string */
|
tmpvar = ast_strdupa(var); /* parse_variable_name modifies the string */
|
||||||
need_substring = parse_variable_name(tmpvar, &offset, &length, &i /* ignored */);
|
need_substring = parse_variable_name(tmpvar, &offset, &length, &i /* ignored */);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look first into predefined variables, then into variable lists.
|
* Look first into predefined variables, then into variable lists.
|
||||||
* Variable 's' points to the result, according to the following rules:
|
* Variable 's' points to the result, according to the following rules:
|
||||||
@@ -5357,7 +5357,7 @@ static void pbx_retrieve_variable(struct ast_channel *c, const char *var, char *
|
|||||||
if (!strcmp(var, "EPOCH")) {
|
if (!strcmp(var, "EPOCH")) {
|
||||||
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
|
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
s = workspace;
|
s = workspace;
|
||||||
}
|
}
|
||||||
/* if not found, look into chanvars or global vars */
|
/* if not found, look into chanvars or global vars */
|
||||||
@@ -5600,11 +5600,11 @@ static int pbx_load_config(const char *config_file)
|
|||||||
autofallthrough_config = ast_true(aft);
|
autofallthrough_config = ast_true(aft);
|
||||||
clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general", "clearglobalvars"));
|
clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general", "clearglobalvars"));
|
||||||
|
|
||||||
if ((cxt = ast_variable_retrieve(cfg, "general", "userscontext")))
|
if ((cxt = ast_variable_retrieve(cfg, "general", "userscontext")))
|
||||||
ast_copy_string(userscontext, cxt, sizeof(userscontext));
|
ast_copy_string(userscontext, cxt, sizeof(userscontext));
|
||||||
else
|
else
|
||||||
ast_copy_string(userscontext, "default", sizeof(userscontext));
|
ast_copy_string(userscontext, "default", sizeof(userscontext));
|
||||||
|
|
||||||
for (v = ast_variable_browse(cfg, "globals"); v; v = v->next) {
|
for (v = ast_variable_browse(cfg, "globals"); v; v = v->next) {
|
||||||
memset(realvalue, 0, sizeof(realvalue));
|
memset(realvalue, 0, sizeof(realvalue));
|
||||||
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
|
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
|
||||||
@@ -5905,7 +5905,7 @@ int localized_pbx_load_module(void)
|
|||||||
printf("Context: %s\n", con->name);
|
printf("Context: %s\n", con->name);
|
||||||
}
|
}
|
||||||
printf("=========\n");
|
printf("=========\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
* Name: frame.c
|
* Name: frame.c
|
||||||
* Version: see static char *standardversion, below.
|
* Version: see static char *standardversion, below.
|
||||||
* Author: Mark Roberts <mark@manumark.de>
|
* Author: Mark Roberts <mark@manumark.de>
|
||||||
* Michael Labuschke <michael@labuschke.de> sys_errlist fixes
|
* Michael Labuschke <michael@labuschke.de> sys_errlist fixes
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* These are useful functions that all DSP programs might find handy
|
* These are useful functions that all DSP programs might find handy
|
||||||
@@ -850,7 +850,7 @@ void parseargs( int argcount, char *args[], int fileswitch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------*
|
/*-------------------------------------------------*
|
||||||
* Set samplefrequency, width, wavout,
|
* Set samplefrequency, width, wavout,
|
||||||
*-------------------------------------------------*/
|
*-------------------------------------------------*/
|
||||||
parseintarg( argcount, args, "f", &samplefrequency);
|
parseintarg( argcount, args, "f", &samplefrequency);
|
||||||
wavout = parseswitcharg( argcount, args, "h");
|
wavout = parseswitcharg( argcount, args, "h");
|
||||||
|
@@ -102,7 +102,7 @@ extern int getremainingfilelength( FILE *anyin, long *result);
|
|||||||
void readpkheader( FILE *anyin);
|
void readpkheader( FILE *anyin);
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
Read a .WAV header from 'anyin'.
|
Read a .WAV header from 'anyin'.
|
||||||
If it is recognised, the data is used.
|
If it is recognised, the data is used.
|
||||||
Otherwise, we assume it's PCM-data and ignore the header.
|
Otherwise, we assume it's PCM-data and ignore the header.
|
||||||
The global variable 'iswav' is set on success, otherwise cleared.
|
The global variable 'iswav' is set on success, otherwise cleared.
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
* Updated for Mac OSX CoreAudio
|
* Updated for Mac OSX CoreAudio
|
||||||
* by Josh Roberson <josh@asteriasgi.com>
|
* by Josh Roberson <josh@asteriasgi.com>
|
||||||
*
|
*
|
||||||
* See http://www.asterisk.org for more information about
|
* See http://www.asterisk.org for more information about
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
*
|
*
|
||||||
* \author Mark Spencer <markster@digium.com>
|
* \author Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
* Updated for Mac OSX CoreAudio
|
* Updated for Mac OSX CoreAudio
|
||||||
* \arg Josh Roberson <josh@asteriasgi.com>
|
* \arg Josh Roberson <josh@asteriasgi.com>
|
||||||
*
|
*
|
||||||
* \note Specially written for Malcolm Davenport, but I think I'll use it too
|
* \note Specially written for Malcolm Davenport, but I think I'll use it too
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
#include "asterisk/autoconfig.h"
|
#include "asterisk/autoconfig.h"
|
||||||
|
|
||||||
#ifdef __Darwin__
|
#ifdef __Darwin__
|
||||||
#include <CoreAudio/AudioHardware.h>
|
#include <CoreAudio/AudioHardware.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -117,7 +117,7 @@ static void add_channel(char *tech, char *location)
|
|||||||
chan->next = channels;
|
chan->next = channels;
|
||||||
channels = chan;
|
channels = chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_config(void)
|
static int load_config(void)
|
||||||
@@ -176,7 +176,7 @@ static int load_config(void)
|
|||||||
} else if (!strcasecmp(buf, "mutelevel")) {
|
} else if (!strcasecmp(buf, "mutelevel")) {
|
||||||
if (val && (sscanf(val, "%3d", &x) == 1) && (x > -1) && (x < 101)) {
|
if (val && (sscanf(val, "%3d", &x) == 1) && (x > -1) && (x < 101)) {
|
||||||
mutelevel = x;
|
mutelevel = x;
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno);
|
fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno);
|
||||||
} else if (!strcasecmp(buf, "channel")) {
|
} else if (!strcasecmp(buf, "channel")) {
|
||||||
if (val && strlen(val)) {
|
if (val && strlen(val)) {
|
||||||
@@ -199,7 +199,7 @@ static int load_config(void)
|
|||||||
fprintf(stderr, "no 'host' specification in config file\n");
|
fprintf(stderr, "no 'host' specification in config file\n");
|
||||||
else if (!strlen(user))
|
else if (!strlen(user))
|
||||||
fprintf(stderr, "no 'user' specification in config file\n");
|
fprintf(stderr, "no 'user' specification in config file\n");
|
||||||
else if (!channels)
|
else if (!channels)
|
||||||
fprintf(stderr, "no 'channel' specifications in config file\n");
|
fprintf(stderr, "no 'channel' specifications in config file\n");
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@@ -286,7 +286,7 @@ static int login_asterisk(void)
|
|||||||
fprintf(stderr, "disconnected (1)\n");
|
fprintf(stderr, "disconnected (1)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fprintf(astf,
|
fprintf(astf,
|
||||||
"Action: Login\r\n"
|
"Action: Login\r\n"
|
||||||
"Username: %s\r\n"
|
"Username: %s\r\n"
|
||||||
"Secret: %s\r\n\r\n", user, pass);
|
"Secret: %s\r\n\r\n", user, pass);
|
||||||
@@ -304,7 +304,7 @@ static int login_asterisk(void)
|
|||||||
fprintf(stderr, "disconnected (3)\n");
|
fprintf(stderr, "disconnected (3)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fprintf(astf,
|
fprintf(astf,
|
||||||
"Action: Status\r\n\r\n");
|
"Action: Status\r\n\r\n");
|
||||||
if (!(welcome = get_line())) {
|
if (!(welcome = get_line())) {
|
||||||
fprintf(stderr, "disconnected (4)\n");
|
fprintf(stderr, "disconnected (4)\n");
|
||||||
@@ -404,7 +404,7 @@ static int setvol(float vol)
|
|||||||
{
|
{
|
||||||
#ifndef __Darwin__
|
#ifndef __Darwin__
|
||||||
if (ioctl(mixfd, MIXER_WRITE(mixchan), &vol)) {
|
if (ioctl(mixfd, MIXER_WRITE(mixchan), &vol)) {
|
||||||
#else
|
#else
|
||||||
float volumeL = vol;
|
float volumeL = vol;
|
||||||
float volumeR = vol;
|
float volumeR = vol;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
@@ -462,7 +462,7 @@ static float mutedlevel(float orig, float level)
|
|||||||
master = level * master / 100.0;
|
master = level * master / 100.0;
|
||||||
return master;
|
return master;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mute(void)
|
static void mute(void)
|
||||||
@@ -479,7 +479,7 @@ static void mute(void)
|
|||||||
vol = getvol();
|
vol = getvol();
|
||||||
oldvol = vol;
|
oldvol = vol;
|
||||||
if (smoothfade)
|
if (smoothfade)
|
||||||
#ifdef __Darwin__
|
#ifdef __Darwin__
|
||||||
start = mutelevel;
|
start = mutelevel;
|
||||||
#else
|
#else
|
||||||
start = 100;
|
start = 100;
|
||||||
@@ -587,7 +587,7 @@ static void append_sub(struct channel *chan, char *name)
|
|||||||
struct subchannel *sub;
|
struct subchannel *sub;
|
||||||
sub = chan->subs;
|
sub = chan->subs;
|
||||||
while(sub) {
|
while(sub) {
|
||||||
if (!strcasecmp(sub->name, name))
|
if (!strcasecmp(sub->name, name))
|
||||||
return;
|
return;
|
||||||
sub = sub->next;
|
sub = sub->next;
|
||||||
}
|
}
|
||||||
@@ -650,7 +650,7 @@ static int wait_event(void)
|
|||||||
strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1);
|
strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1);
|
||||||
}
|
}
|
||||||
if (strlen(channel)) {
|
if (strlen(channel)) {
|
||||||
if (!strcasecmp(event, "Hangup"))
|
if (!strcasecmp(event, "Hangup"))
|
||||||
hangup_chan(channel);
|
hangup_chan(channel);
|
||||||
else
|
else
|
||||||
offhook_chan(channel);
|
offhook_chan(channel);
|
||||||
@@ -711,7 +711,7 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (login_asterisk()) {
|
if (login_asterisk()) {
|
||||||
#ifndef __Darwin__
|
#ifndef __Darwin__
|
||||||
close(mixfd);
|
close(mixfd);
|
||||||
#endif
|
#endif
|
||||||
fclose(astf);
|
fclose(astf);
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* \brief reads next USC character from null terminated UTF-8 string and advanced pointer
|
* \brief reads next USC character from null terminated UTF-8 string and advanced pointer
|
||||||
* for non valid UTF-8 sequences.
|
* for non valid UTF-8 sequences.
|
||||||
* \return character as is Does \b NOT advance pointer for null termination
|
* \return character as is Does \b NOT advance pointer for null termination
|
||||||
*/
|
*/
|
||||||
static int utf8decode (unsigned char **pp)
|
static int utf8decode (unsigned char **pp)
|
||||||
{
|
{
|
||||||
@@ -92,12 +92,12 @@ static int utf8decode (unsigned char **pp)
|
|||||||
return *p; /* not sensible */
|
return *p; /* not sensible */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief check for any queued messages in specific queue (queue="" means any queue)
|
* \brief check for any queued messages in specific queue (queue="" means any queue)
|
||||||
* \param dir,queue,subaddress,channel,callerid,wait,delay,retries,concurrent
|
* \param dir,queue,subaddress,channel,callerid,wait,delay,retries,concurrent
|
||||||
* \retval 0 if nothing queued
|
* \retval 0 if nothing queued
|
||||||
* \retval 1 if queued and outgoing set up OK
|
* \retval 1 if queued and outgoing set up OK
|
||||||
* \retval 2 of outgoing exists
|
* \retval 2 of outgoing exists
|
||||||
*/
|
*/
|
||||||
static char txqcheck (char *dir, char *queue, char subaddress, char *channel, char *callerid, int wait, int delay, int retries, int concurrent)
|
static char txqcheck (char *dir, char *queue, char subaddress, char *channel, char *callerid, int wait, int delay, int retries, int concurrent)
|
||||||
{
|
{
|
||||||
@@ -193,7 +193,7 @@ static char txqcheck (char *dir, char *queue, char subaddress, char *channel, ch
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Process received queue entries
|
* \brief Process received queue entries
|
||||||
* Run through a process, setting environment variables
|
* Run through a process, setting environment variables
|
||||||
*/
|
*/
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file
|
* \file
|
||||||
* \author Russell Bryant <russell@digium.com>
|
* \author Russell Bryant <russell@digium.com>
|
||||||
*
|
*
|
||||||
* \brief A utility for reading from a raw TCP stream
|
* \brief A utility for reading from a raw TCP stream
|
||||||
*
|
*
|
||||||
* This application is intended for use when a raw TCP stream is desired to be
|
* This application is intended for use when a raw TCP stream is desired to be
|
||||||
@@ -84,33 +84,33 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(&sin, 0, sizeof(sin));
|
memset(&sin, 0, sizeof(sin));
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(atoi(argv[2]));
|
sin.sin_port = htons(atoi(argv[2]));
|
||||||
memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
|
memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
|
||||||
|
|
||||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
fprintf(stderr, "Unable to allocate socket!\n");
|
fprintf(stderr, "Unable to allocate socket!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = connect(s, (struct sockaddr *)&sin, sizeof(sin));
|
res = connect(s, (struct sockaddr *)&sin, sizeof(sin));
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
fprintf(stderr, "Unable to connect to host!\n");
|
fprintf(stderr, "Unable to connect to host!\n");
|
||||||
close(s);
|
close(s);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
res = read(s, buf, sizeof(buf));
|
res = read(s, buf, sizeof(buf));
|
||||||
|
|
||||||
if (res < 1)
|
if (res < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
memset(&tv, 0, sizeof(tv));
|
memset(&tv, 0, sizeof(tv));
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
FD_SET(1, &wfds);
|
FD_SET(1, &wfds);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user