summaryrefslogtreecommitdiffstats
path: root/generic/tkOption.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-11-11 10:18:08 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-11-11 10:18:08 (GMT)
commit8257004eff7efcb4440402734dfd667354f89932 (patch)
treedf51f468ddbcf96fddcb360128744946c1a034f2 /generic/tkOption.c
parent61d2c57eee979c573c77480573181f5e4c862109 (diff)
parentf9b06d175f3ce097921a88bd64bbcf6dba8ac78e (diff)
downloadtk-8257004eff7efcb4440402734dfd667354f89932.zip
tk-8257004eff7efcb4440402734dfd667354f89932.tar.gz
tk-8257004eff7efcb4440402734dfd667354f89932.tar.bz2
Fix [0aa5e852dc]: Accept newline characters as value in Tk option files
Diffstat (limited to 'generic/tkOption.c')
-rw-r--r--generic/tkOption.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 2a8d501..75dc3b9 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -1016,14 +1016,25 @@ AddFromString(
Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "NEWLINE", NULL);
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;