pbx: Create pbx_ignorepat.c for management of 'struct ast_ignorepat'.
[asterisk/asterisk.git] / utils / ael_main.c
index 2237625..d2c815b 100644 (file)
@@ -48,7 +48,7 @@ struct namelist
        struct namelist *next;
 };
 
-struct ast_context 
+struct ast_context
 {
        int extension_count;
        char name[100];
@@ -103,7 +103,7 @@ static char var_dir[PATH_MAX];
 const char *ast_config_AST_CONFIG_DIR = config_dir;
 const char *ast_config_AST_VAR_DIR = var_dir;
 
-void ast_cli_register_multiple(void);
+void __ast_cli_register_multiple(void);
 int ast_add_extension2(struct ast_context *con,
                                           int replace, const char *extension, int priority, const char *label, const char *callerid,
                                                const char *application, void *data, void (*datad)(void *),
@@ -136,7 +136,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
 {
                va_list vars;
                        va_start(vars,fmt);
-                       
+
                                printf("LOG: lev:%d file:%s  line:%d func: %s  ",
                                                                   level, file, line, function);
                                        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_context *bypass,
                                                                         struct pbx_find_info *q,
-                                                                        const char *context, 
-                                                                        const char *exten, 
+                                                                        const char *context,
+                                                                        const char *exten,
                                                                         int priority,
-                                                                        const char *label, 
-                                                                        const char *callerid, 
+                                                                        const char *label,
+                                                                        const char *callerid,
                                                                         enum ext_match_t action);
 
 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
                                                                         struct ast_context *bypass,
                                                                         struct pbx_find_info *q,
-                                                                        const char *context, 
-                                                                        const char *exten, 
+                                                                        const char *context,
+                                                                        const char *exten,
                                                                         int priority,
-                                                                        const char *label, 
-                                                                        const char *callerid, 
+                                                                        const char *label,
+                                                                        const char *callerid,
                                                                         enum ext_match_t action)
 {
        return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
@@ -208,7 +208,7 @@ void ast_module_unregister(const struct ast_module_info *x)
 }
 
 
-void ast_cli_register_multiple(void)
+void __ast_cli_register_multiple(void)
 {
        if(!no_comp)
                printf("Executed ast_cli_register_multiple();\n");
@@ -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)
 {
        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,
                                                                                           so....! */
        else
@@ -255,15 +255,15 @@ int ast_add_extension2(struct ast_context *con,
 
                if( FIRST_TIME ) {
                        FIRST_TIME = 0;
-                       
+
                        if( globalvars )
                                fprintf(dumpfile,"[globals]\n");
-                       
+
                        for(n=globalvars;n;n=n->next) {
                                fprintf(dumpfile, "%s\n", n->name);
                        }
                }
-               
+
                /* print out each extension , possibly the context header also */
                if( con != last_context ) {
                        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) {
                                fprintf(dumpfile, "eswitch => %s/%s\n", n->name, n->name2);
                        }
-                       
+
                }
                if( 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);
                }
        }
-       
+
        /* since add_extension2 is responsible for the malloc'd data stuff */
        free(data);
        return 0;
@@ -320,7 +320,7 @@ void pbx_builtin_setvar(void *chan, void *data)
                ADD_LAST(globalvars,x);
        }
 }
-       
+
 
 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 */
        char *t, *v, *u = str;
-       
+
        while ( u && *u ) {
 
                if( *u == '$' && *(u+1) == '[' ) {
@@ -471,7 +471,7 @@ void filter_leading_space_from_exprs(char *str)
                                }
                        }
                }
-               
+
                u++;
        }
 }
@@ -500,7 +500,7 @@ int main(int argc, char **argv)
        int i;
        struct namelist *n;
        struct ast_context *lp,*lp2;
-       
+
        for(i=1;i<argc;i++) {
                if( argv[i][0] == '-' && argv[i][1] == 'n' )
                        no_comp =1;
@@ -513,7 +513,7 @@ int main(int argc, char **argv)
                if( argv[i][0] == '-' && argv[i][1] == 'w' )
                        dump_extensions =1;
        }
-       
+
        if( !quiet ) {
                printf("\n(If you find progress and other non-error messages irritating, you can use -q to suppress them)\n");
                if( !no_comp )
@@ -533,30 +533,30 @@ int main(int argc, char **argv)
                localized_use_conf_dir();
        }
        strcpy(var_dir, "/var/lib/asterisk");
-       
+
        if( dump_extensions ) {
                dumpfile = fopen("extensions.conf.aeldump","w");
                if( !dumpfile ) {
                        printf("\n\nSorry, cannot open extensions.conf.aeldump for writing! Correct the situation and try again!\n\n");
                        exit(10);
                }
-               
+
        }
 
        FIRST_TIME = 1;
-       
+
        ael_external_load_module();
-       
+
        ast_log(4, "ael2_parse", __LINE__, "main", "%d contexts, %d extensions, %d priorities\n", conts, extens, priors);
 
        if( dump_extensions && dumpfile ) {
-       
+
                for( lp = context_list; lp; lp = lp->next ) { /* print out any contexts that didn't have any
                                                                                                                 extensions in them */
                        if( lp->extension_count == 0 ) {
-                               
+
                                fprintf(dumpfile,"\n\n[%s]\n", lp->name);
-                               
+
                                for(n=lp->ignorepats;n;n=n->next) {
                                        fprintf(dumpfile, "ignorepat => %s\n", n->name);
                                }
@@ -572,10 +572,10 @@ int main(int argc, char **argv)
                        }
                }
        }
-       
+
        if( dump_extensions && dumpfile )
                fclose(dumpfile);
-       
+
        for( lp = context_list; lp; lp = lp2 ) { /* free the ast_context structs */
                lp2 = lp->next;
                lp->next = 0;
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
 
                free(lp);
        }
-       
+
     return 0;
 }