[svn-commits] tilghman: branch 1.4 r117519 - in /branches/1.4: main/asterisk.c pbx/pbx_spool.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 21 13:40:15 CDT 2008


Author: tilghman
Date: Wed May 21 13:40:14 2008
New Revision: 117519

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117519
Log:
Strip the preamble from the output also when -rx is not being used
(Related to issue #12702)

Modified:
    branches/1.4/main/asterisk.c
    branches/1.4/pbx/pbx_spool.c

Modified: branches/1.4/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/asterisk.c?view=diff&rev=117519&r1=117518&r2=117519
==============================================================================
--- branches/1.4/main/asterisk.c (original)
+++ branches/1.4/main/asterisk.c Wed May 21 13:40:14 2008
@@ -2347,6 +2347,14 @@
 			if (ebuf[strlen(ebuf)-1] == '\n')
 				ebuf[strlen(ebuf)-1] = '\0';
 			if (!remoteconsolehandler(ebuf)) {
+				/* Strip preamble from output */
+				char *tmp;
+				for (tmp = ebuf; *tmp; tmp++) {
+					if (*tmp == 127) {
+						memmove(tmp, tmp + 1, strlen(tmp));
+						tmp--;
+					}
+				}
 				res = write(ast_consock, ebuf, strlen(ebuf) + 1);
 				if (res < 1) {
 					ast_log(LOG_WARNING, "Unable to write: %s\n", strerror(errno));

Modified: branches/1.4/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_spool.c?view=diff&rev=117519&r1=117518&r2=117519
==============================================================================
--- branches/1.4/pbx/pbx_spool.c (original)
+++ branches/1.4/pbx/pbx_spool.c Wed May 21 13:40:14 2008
@@ -128,7 +128,11 @@
 	char buf[256];
 	char *c, *c2;
 	int lineno = 0;
-	struct ast_variable *var;
+	struct ast_variable *var, *last = o->vars;
+
+	while (last && last->next) {
+		last = last->next;
+	}
 
 	while(fgets(buf, sizeof(buf), f)) {
 		lineno++;
@@ -222,8 +226,13 @@
 					if (c2) {
 						var = ast_variable_new(c, c2);
 						if (var) {
-							var->next = o->vars;
-							o->vars = var;
+							/* Always insert at the end, because some people want to treat the spool file as a script */
+							if (last) {
+								last->next = var;
+							} else {
+								o->vars = var;
+							}
+							last = var;
 						}
 					} else
 						ast_log(LOG_WARNING, "Malformed \"%s\" argument.  Should be \"%s: variable=value\"\n", buf, buf);




More information about the svn-commits mailing list