[asterisk-commits] tilghman: trunk r158605 - /trunk/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 21 17:33:22 CST 2008


Author: tilghman
Date: Fri Nov 21 17:33:22 2008
New Revision: 158605

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158605
Log:
Allow space within an extension, when the space is within a character class.
(requested by lmadsen on -dev, patch by me)

Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=158605&r1=158604&r2=158605
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Nov 21 17:33:22 2008
@@ -7228,18 +7228,19 @@
 static int ext_strncpy(char *dst, const char *src, int len)
 {
 	int count = 0;
+	int insquares = 0;
 
 	while (*src && (count < len - 1)) {
-		switch (*src) {
-		case ' ':
-			/*	otherwise exten => [a-b],1,... doesn't work */
-			/*		case '-': */
-			/* Ignore */
-			break;
-		default:
-			*dst = *src;
-			dst++;
-		}
+		if (*src == '[') {
+			insquares = 1;
+		} else if (*src == ']') {
+			insquares = 0;
+		} else if (*src == ' ' && !insquares) {
+			src++;
+			continue;
+		}
+		*dst = *src;
+		dst++;
 		src++;
 		count++;
 	}




More information about the asterisk-commits mailing list