diff options
author | Mark Spencer <markster@digium.com> | 2004-01-12 05:05:35 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-01-12 05:05:35 +0000 |
commit | ee342cc3b80db292625e41019a3afd8bb4cdc568 (patch) | |
tree | 02f9ec032bd53fec6e9b9004db327ad9991cf73a /pbx/pbx_config.c | |
parent | 5520872def04f3fe7cc61f23edf4b9c87007a02d (diff) |
Add ww's improved syslog support (bug #587)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/pbx_config.c')
-rwxr-xr-x | pbx/pbx_config.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index d68c5adf4..b0a55978d 100755 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -903,6 +903,8 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) { char filename[256]; struct ast_context *c; + struct ast_config *cfg; + struct ast_variable *var; int context_header_written; int incomplete = 0; /* incomplete config write? */ FILE *output; @@ -922,6 +924,9 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) return RESULT_FAILURE; } + /* Load old file first */ + cfg = ast_load(config); + /* have config path? */ if (argc == 3) { /* is there extension.conf too? */ @@ -946,6 +951,8 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) if (ast_lock_contexts()) { ast_cli(fd, "Failed to lock contexts list\n"); ast_mutex_unlock(&save_dialplan_lock); + if (cfg) + ast_destroy(cfg); return RESULT_FAILURE; } @@ -955,6 +962,8 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) filename); ast_unlock_contexts(); ast_mutex_unlock(&save_dialplan_lock); + if (cfg) + ast_destroy(cfg); return RESULT_FAILURE; } @@ -963,6 +972,15 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) static_config ? "yes" : "no", write_protect_config ? "yes" : "no"); + var = ast_variable_walk(cfg, "globals"); + if (var) { + fprintf(output, "[globals]\n"); + while(var) { + fprintf(output, "%s => %s", var->name, var->value); + var = var->next; + } + } + /* walk all contexts */ c = ast_walk_contexts(NULL); while (c) { @@ -1079,6 +1097,8 @@ static int handle_save_dialplan(int fd, int argc, char *argv[]) ast_unlock_contexts(); ast_mutex_unlock(&save_dialplan_lock); fclose(output); + if (cfg) + ast_destroy(cfg); if (incomplete) { ast_cli(fd, "Saved dialplan is incomplete\n"); |