[svn-commits] tilghman: branch 1.6.0 r115335 - in /branches/1.6.0: ./ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon May 5 18:01:22 CDT 2008


Author: tilghman
Date: Mon May  5 18:01:22 2008
New Revision: 115335

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115335
Log:
Merged revisions 115334 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r115334 | tilghman | 2008-05-05 18:00:31 -0500 (Mon, 05 May 2008) | 15 lines

Merged revisions 115333 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115333 | tilghman | 2008-05-05 17:50:31 -0500 (Mon, 05 May 2008) | 7 lines

Separate verbose output from CLI output, by using a preamble.
(closes issue #12402)
 Reported by: Corydon76
 Patches: 
       20080410__no_verbose_in_rx_output.diff.txt uploaded by Corydon76 (license 14)
       20080501__no_verbose_in_rx_output__1.4.diff.txt uploaded by Corydon76 (license 14)

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/main/asterisk.c
    branches/1.6.0/main/logger.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=115335&r1=115334&r2=115335
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Mon May  5 18:01:22 2008
@@ -1420,6 +1420,12 @@
 static const char *fix_header(char *outbuf, int maxout, const char *s, char *cmp)
 {
 	const char *c;
+
+	/* Check for verboser preamble */
+	if (*s == 127) {
+		s++;
+	}
+
 	if (!strncmp(s, cmp, strlen(cmp))) {
 		c = s + strlen(cmp);
 		term_color(outbuf, cmp, COLOR_GRAY, 0, maxout);
@@ -1928,6 +1934,7 @@
 
 			buf[res] = '\0';
 
+			/* Write over the CLI prompt */
 			if (!ast_opt_exec && !lastpos)
 				write(STDOUT_FILENO, "\r", 1);
 			write(STDOUT_FILENO, buf, res);
@@ -2425,13 +2432,38 @@
 		ast_el_read_history(filename);
 
 	if (ast_opt_exec && data) {  /* hack to print output then exit if asterisk -rx is used */
-		char tempchar;
 		struct pollfd fds;
 		fds.fd = ast_consock;
 		fds.events = POLLIN;
 		fds.revents = 0;
-		while (poll(&fds, 1, 100) > 0)
-			ast_el_read_char(el, &tempchar);
+		while (poll(&fds, 1, 500) > 0) {
+			char buf[512] = "", *curline = buf, *nextline;
+			int not_written = 1;
+
+			if (read(ast_consock, buf, sizeof(buf) - 1) < 0) {
+				break;
+			}
+
+			do {
+				if ((nextline = strchr(curline, '\n'))) {
+					nextline++;
+				} else {
+					nextline = strchr(curline, '\0');
+				}
+
+				/* Skip verbose lines */
+				if (*curline != 127) {
+					not_written = 0;
+					write(STDOUT_FILENO, curline, nextline - curline + (*nextline == '\0' ? 1 : 0));
+				}
+				curline = nextline;
+			} while (!ast_strlen_zero(curline));
+
+			/* No non-verbose output in 500ms */
+			if (not_written) {
+				break;
+			}
+		}
 		return;
 	}
 	for (;;) {

Modified: branches/1.6.0/main/logger.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/logger.c?view=diff&rev=115335&r1=115334&r2=115335
==============================================================================
--- branches/1.6.0/main/logger.c (original)
+++ branches/1.6.0/main/logger.c Mon May  5 18:01:22 2008
@@ -1127,8 +1127,12 @@
 		ast_localtime(&tv, &tm, NULL);
 		ast_strftime(date, sizeof(date), dateformat, &tm);
 		datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
-		sprintf(datefmt, "[%s] %s", date, fmt);
+		sprintf(datefmt, "%c[%s] %s", 127, date, fmt);
 		fmt = datefmt;
+	} else {
+		char *tmp = alloca(strlen(fmt) + 2);
+		sprintf(tmp, "%c%s", 127, fmt);
+		fmt = tmp;
 	}
 
 	/* Build string */
@@ -1145,7 +1149,7 @@
 
 	strcpy(logmsg->str, buf->str);
 
-	ast_log(LOG_VERBOSE, "%s", logmsg->str);
+	ast_log(LOG_VERBOSE, "%s", logmsg->str + 1);
 
 	/* Set type */
 	logmsg->type = LOGMSG_VERBOSE;




More information about the svn-commits mailing list