diff compat.c @ 73:2f339dd13496

Added C/C++ style escape sequence processing. And fixed a couple OS/2 and Windows bugs.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 18 Feb 2002 08:43:34 +0000
parents ab77a22a2a36
children f794f2baabf2
line wrap: on
line diff
--- a/compat.c	Fri Feb 15 09:30:50 2002 +0000
+++ b/compat.c	Mon Feb 18 08:43:34 2002 +0000
@@ -806,7 +806,41 @@
 				{
 					/* Use defaults on blank lines */
 					if(text[0])
-						locale_text[current] = strdup(text);
+					{
+						int x = 0, z, len = strlen(text);
+
+						locale_text[current] = calloc(1, len + 1);
+
+						for(z=0;z<len;z++)
+						{
+							if(text[z] == '\\' && (text[z+1] == 'r' || text[z+1] == 'n'
+							   || text[z+1] == '\"'  || text[z+1] == '\''))
+							{
+								switch(text[z+1])
+								{
+								case 'r':
+									locale_text[current][x] = '\r';
+                                    break;
+								case 'n':
+									locale_text[current][x] = '\n';
+                                    break;
+								case '\"':
+									locale_text[current][x] = '\"';
+                                    break;
+								case '\'':
+									locale_text[current][x] = '\'';
+                                    break;
+								}
+								x++;
+								z++;
+							}
+							else
+							{
+								locale_text[current][x] = text[z];
+								x++;
+							}
+						}
+					}
 					current++;
 				}
 			}