[Asterisk-cvs] asterisk/pbx pbx_config.c,1.30,1.31

markster at lists.digium.com markster at lists.digium.com
Sun Jan 11 23:13:49 CST 2004


Update of /usr/cvsroot/asterisk/pbx
In directory mongoose.digium.com:/tmp/cvs-serv24616/pbx

Modified Files:
	pbx_config.c 
Log Message:
Add ww's improved syslog support (bug #587)


Index: pbx_config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_config.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- pbx_config.c	3 Dec 2003 02:45:24 -0000	1.30
+++ pbx_config.c	12 Jan 2004 05:05:35 -0000	1.31
@@ -903,6 +903,8 @@
 {
 	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 @@
 		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 @@
 	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 @@
 			filename);
 		ast_unlock_contexts();
 		ast_mutex_unlock(&save_dialplan_lock);
+		if (cfg)
+			ast_destroy(cfg);
 		return RESULT_FAILURE;
 	}
 
@@ -963,6 +972,15 @@
 		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 @@
 	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");




More information about the svn-commits mailing list