[Asterisk-cvs] asterisk callerid.c,1.23,1.24

markster at lists.digium.com markster at lists.digium.com
Fri Oct 8 11:48:26 CDT 2004


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

Modified Files:
	callerid.c 
Log Message:
Don't strip bracketed hyphens (bug #2608)


Index: callerid.c
===================================================================
RCS file: /usr/cvsroot/asterisk/callerid.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- callerid.c	2 Oct 2004 00:58:31 -0000	1.23
+++ callerid.c	8 Oct 2004 15:49:37 -0000	1.24
@@ -574,9 +574,26 @@
 void ast_shrink_phone_number(char *n)
 {
 	int x,y=0;
-	for (x=0;n[x];x++)
-		if (!strchr("( )-.", n[x]))
+	int bracketed=0;
+	for (x=0;n[x];x++) {
+		switch(n[x]) {
+		case '[':
+			bracketed++;
+			n[y++] = n[x];
+			break;
+		case ']':
+			bracketed--;
 			n[y++] = n[x];
+			break;
+		case '-':
+			if (bracketed)
+				n[y++] = n[x];
+			break;
+		default:
+			if (!strchr("( ).", n[x]))
+				n[y++] = n[x];
+		}
+	}
 	n[y] = '\0';
 }
 




More information about the svn-commits mailing list