--- config.c 2004-09-03 18:36:13.000000000 +0300 +++ ../asterisk-1.0.1/config.c 2004-11-10 14:15:13.000000000 +0200 @@ -17,6 +17,10 @@ #include #include #include +#define AST_INCLUDE_GLOB 1 +#ifdef AST_INCLUDE_GLOB +# include +#endif #include #include #include @@ -782,6 +786,51 @@ ast_verbose( VERBOSE_PREFIX_2 "Parsing '%s': ", fn); fflush(stdout); } +#ifdef AST_INCLUDE_GLOB + { + int glob_ret; + glob_t globbuf; /*pretend it is initilized to silent gcc */ + globbuf.gl_offs = 0; + glob_ret = glob(fn, GLOB_NOCHECK|GLOB_BRACE, NULL, &globbuf); + ast_log(LOG_NOTICE, + "Glob Expansion Results: Return: %d, Number of results: %d," + " (config file: %s, full path: %s", + glob_ret, globbuf.gl_pathc, configfile, fn); + + + if (glob_ret==GLOB_NOMATCH){ + /* warn, but continue. Chances are that the user will get + * an error message later on for file access error. + * Or maybe the user actually wants to use a file whose name + * contains an Asterisk?*/ + ast_log(LOG_WARNING, + "Glob Expansion of pattern '%s' ('%s') failed: no match. " + "But I'll use the original pattern.\n", + configfile, fn); + } + if (glob_ret==GLOB_NOSPACE){ + ast_log(LOG_WARNING, + "Glob Expansion of pattern '%s' ('%s') failed: Not enough memory\n", + configfile, fn); + } else if (glob_ret==GLOB_ABORTED){ + ast_log(LOG_WARNING, + "Glob Expansion of pattern '%s' ('%s) failed: Read error\n", + configfile, fn); + } else { + ast_log(LOG_NOTICE, + "Glob Expansion of pattern '%s' ('%s'): Success. " + "Starting to loop\n", + configfile, fn); + + /* loop over expanded files */ + /* TODO: to simplify the patch I re-use 'arg', and thus + * override the original pattern + */ + int i; + for (i=0; i 1) ast_verbose( "Not found (%s)\n", strerror(errno)); } +#ifdef AST_INCLUDE_GLOB + } + globfree(&globbuf); + } + } +#endif #ifdef PRESERVE_COMMENTS if (master) { /* Keep trailing comments */