summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-11-11 10:05:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-11-11 10:05:55 (GMT)
commit6d173aa6be98d083b288206ad2c036bc37799c89 (patch)
tree9345a2f89657cf2a8c29be397c9cfb930f7f8fe3 /generic
parent0d3be39618038448f3387fb51a63b0e29070d0a1 (diff)
downloadtk-6d173aa6be98d083b288206ad2c036bc37799c89.zip
tk-6d173aa6be98d083b288206ad2c036bc37799c89.tar.gz
tk-6d173aa6be98d083b288206ad2c036bc37799c89.tar.bz2
Fix [0aa5e852dc]: Accept newline characters as value in Tk option files
Diffstat (limited to 'generic')
-rw-r--r--generic/tkOption.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/generic/tkOption.c b/generic/tkOption.c
index de92627..91a6cc0 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -1019,14 +1019,25 @@ AddFromString(
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
- if ((src[0] == '\\') && (src[1] == '\n')) {
- src += 2;
- lineNum++;
- } else {
- *dst = *src;
- dst++;
- src++;
+ if (*src == '\\'){
+ if (src[1] == '\n') {
+ src += 2;
+ lineNum++;
+ continue;
+ } else if (src[1] == 'n') {
+ src += 2;
+ *dst++ = '\n';
+ continue;
+ } else if (src[1] == '\t' || src[1] == ' ' || src[1] == '\\') {
+ ++src;
+ } else if (src[1] >= '0' && src[1] <= '3' && src[2] >= '0' &&
+ src[2] <= '9' && src[3] >= '0' && src[3] <= '9') {
+ *dst++ = ((src[1]&7)<<6) | ((src[2]&7)<<3) | (src[3]&7);
+ src += 4;
+ continue;
+ }
}
+ *dst++ = *src++;
}
*dst = 0;