[Asterisk-cvs] asterisk utils.c,1.69,1.70

russell russell
Thu Sep 22 22:59:46 CDT 2005


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

Modified Files:
	utils.c 
Log Message:
move process_quotes_and_slashes to utils.c since it is used by both pbx_ael and pbx_config
clean up some formatting
remove some commented out reference code
move unload_module in pbx_ael down to be with the rest of the standard module functions


Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- utils.c	14 Sep 2005 20:46:49 -0000	1.69
+++ utils.c	23 Sep 2005 02:57:14 -0000	1.70
@@ -799,3 +799,29 @@
 	 return acc;
 }
 #endif
+
+char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
+{
+ 	char *dataPut = start;
+	int inEscape = 0;
+	int inQuotes = 0;
+
+	for (; *start; start++) {
+		if (inEscape) {
+			*dataPut++ = *start;       /* Always goes verbatim */
+			inEscape = 0;
+    		} else {
+			if (*start == '\\') {
+				inEscape = 1;      /* Do not copy \ into the data */
+			} else if (*start == '\'') {
+				inQuotes = 1-inQuotes;   /* Do not copy ' into the data */
+			} else {
+				/* Replace , with |, unless in quotes */
+				*dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start);
+			}
+		}
+	}
+	if (start != dataPut)
+		*dataPut = 0;
+	return dataPut;
+}




More information about the svn-commits mailing list