[asterisk-commits] tilghman: branch 1.4 r87067 - /branches/1.4/funcs/func_cut.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 25 17:53:06 CDT 2007


Author: tilghman
Date: Thu Oct 25 17:53:06 2007
New Revision: 87067

URL: http://svn.digium.com/view/asterisk?view=rev&rev=87067
Log:
Backport alternate encoding of newline delimiters from trunk to 1.4, as approved by Russell
Reported by blitzrage
Closes issue #10903

Modified:
    branches/1.4/funcs/func_cut.c

Modified: branches/1.4/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_cut.c?view=diff&rev=87067&r1=87066&r2=87067
==============================================================================
--- branches/1.4/funcs/func_cut.c (original)
+++ branches/1.4/funcs/func_cut.c Thu Oct 25 17:53:06 2007
@@ -145,7 +145,21 @@
 			return ERROR_NOMEM;
 		}
 
-		d = args.delimiter[0] ? args.delimiter[0] : '-';
+		if (args.delimiter[0] == '\\') {
+			if (args.delimiter[1] == 'n')
+				d = '\n';
+			else if (args.delimiter[1] == 't')
+				d = '\t';
+			else if (args.delimiter[1] == 'r')
+				d = '\r';
+			else if (args.delimiter[1])
+				d = args.delimiter[1];
+			else
+				d = '-';
+		} else if (args.delimiter[0])
+			d = args.delimiter[0];
+		else
+			d = '-';
 
 		/* String form of the delimiter, for use with strsep(3) */
 		snprintf(ds, sizeof(ds), "%c", d);




More information about the asterisk-commits mailing list