summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2007-11-05 19:37:06 (GMT)
committerandreas_kupries <akupries@shaw.ca>2007-11-05 19:37:06 (GMT)
commit791ccfdcdbc2bee84c4100c5a2c66e600ff247c2 (patch)
treea583a45bbf5dd65eee5023809fa22a5903bc9737 /unix
parent71b6a5824485a25d8b7be9c26103252cb50ed5f6 (diff)
downloadtcl-791ccfdcdbc2bee84c4100c5a2c66e600ff247c2.zip
tcl-791ccfdcdbc2bee84c4100c5a2c66e600ff247c2.tar.gz
tcl-791ccfdcdbc2bee84c4100c5a2c66e600ff247c2.tar.bz2
* unix/tclUnixChan.c (TtyGetOptionProc): Accepted [SF Tcl Patch
1823576] provided by Stuart Cassof <stwo@users.sourceforge.net>. The patch adds the necessary utf/external conversions to the handling of the arguments of option -xchar which will allow the use of \0 and similar characters.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixChan.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 15629a2..aeb8539 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.82 2007/09/17 11:38:14 das Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.83 2007/11/05 19:37:07 andreas_kupries Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -967,8 +967,16 @@ TtySetOptionProc(
return TCL_ERROR;
}
if (argc == 2) {
- iostate.c_cc[VSTART] = argv[0][0];
- iostate.c_cc[VSTOP] = argv[1][0];
+ Tcl_DString ds;
+ Tcl_DStringInit(&ds);
+
+ Tcl_UtfToExternalDString(NULL, argv[0], -1, &ds);
+ iostate.c_cc[VSTART] = *(const cc_t *) Tcl_DStringValue(&ds);
+ Tcl_DStringSetLength(&ds, 0);
+
+ Tcl_UtfToExternalDString(NULL, argv[1], -1, &ds);
+ iostate.c_cc[VSTOP] = *(const cc_t *) Tcl_DStringValue(&ds);
+ Tcl_DStringFree(&ds);
} else {
if (interp) {
Tcl_AppendResult(interp, "bad value for -xchar: "
@@ -1142,13 +1150,19 @@ TtyGetOptionProc(
}
if (len==0 || (len>1 && strncmp(optionName, "-xchar", len)==0)) {
IOSTATE iostate;
-
+ Tcl_DString ds;
valid = 1;
+
GETIOSTATE(fsPtr->fd, &iostate);
- sprintf(buf, "%c", iostate.c_cc[VSTART]);
- Tcl_DStringAppendElement(dsPtr, buf);
- sprintf(buf, "%c", iostate.c_cc[VSTOP]);
- Tcl_DStringAppendElement(dsPtr, buf);
+ Tcl_DStringInit(&ds);
+
+ Tcl_ExternalToUtfDString(NULL, (const char *) &iostate.c_cc[VSTART], 1, &ds);
+ Tcl_DStringAppendElement(dsPtr, (const char *) Tcl_DStringValue(&ds));
+ Tcl_DStringSetLength(&ds, 0);
+
+ Tcl_ExternalToUtfDString(NULL, (const char *) &iostate.c_cc[VSTOP], 1, &ds);
+ Tcl_DStringAppendElement(dsPtr, (const char *) Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
}
if (len == 0) {
Tcl_DStringEndSublist(dsPtr);