summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index cc0af2e..63579ee 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -7777,7 +7777,7 @@ Tcl_BadChannelOption(
{
if (interp != NULL) {
const char *genericopt =
- "blocking buffering buffersize encoding encodingprofile eofchar translation";
+ "blocking buffering buffersize encoding eofchar profile translation";
const char **argv;
Tcl_Size argc, i;
Tcl_DString ds;
@@ -7918,7 +7918,7 @@ Tcl_GetChannelOption(
return TCL_OK;
}
}
- if (len == 0 || HaveOpt(8, "-encoding")) {
+ if (len == 0 || HaveOpt(2, "-encoding")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-encoding");
}
@@ -7932,11 +7932,25 @@ Tcl_GetChannelOption(
return TCL_OK;
}
}
- if (len == 0 || HaveOpt(9, "-encodingprofile")) {
+ if (len == 0 || HaveOpt(2, "-eofchar")) {
+ char buf[4] = "";
+ if (len == 0) {
+ Tcl_DStringAppendElement(dsPtr, "-eofchar");
+ }
+ if ((flags & TCL_READABLE) && (statePtr->inEofChar != 0)) {
+ sprintf(buf, "%c", statePtr->inEofChar);
+ }
+ if (len > 0) {
+ Tcl_DStringAppend(dsPtr, buf, TCL_INDEX_NONE);
+ return TCL_OK;
+ }
+ Tcl_DStringAppendElement(dsPtr, buf);
+ }
+ if (len == 0 || HaveOpt(1, "-profile")) {
int profile;
const char *profileName;
if (len == 0) {
- Tcl_DStringAppendElement(dsPtr, "-encodingprofile");
+ Tcl_DStringAppendElement(dsPtr, "-profile");
}
/* Note currently input and output profiles are same */
profile = TCL_ENCODING_PROFILE_GET(statePtr->inputEncodingFlags);
@@ -7949,20 +7963,6 @@ Tcl_GetChannelOption(
return TCL_OK;
}
}
- if (len == 0 || HaveOpt(2, "-eofchar")) {
- char buf[4] = "";
- if (len == 0) {
- Tcl_DStringAppendElement(dsPtr, "-eofchar");
- }
- if ((flags & TCL_READABLE) && (statePtr->inEofChar != 0)) {
- sprintf(buf, "%c", statePtr->inEofChar);
- }
- if (len > 0) {
- Tcl_DStringAppend(dsPtr, buf, TCL_INDEX_NONE);
- return TCL_OK;
- }
- Tcl_DStringAppendElement(dsPtr, buf);
- }
if (len == 0 || HaveOpt(1, "-translation")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-translation");
@@ -8142,7 +8142,7 @@ Tcl_SetChannelOption(
}
Tcl_SetChannelBufferSize(chan, newBufferSize);
return TCL_OK;
- } else if (HaveOpt(8, "-encoding")) {
+ } else if (HaveOpt(2, "-encoding")) {
Tcl_Encoding encoding;
int profile;
@@ -8178,15 +8178,6 @@ Tcl_SetChannelOption(
ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR);
UpdateInterest(chanPtr);
return TCL_OK;
- } else if (HaveOpt(9, "-encodingprofile")) {
- int profile;
- if (TclEncodingProfileNameToId(interp, newValue, &profile) != TCL_OK) {
- return TCL_ERROR;
- }
- TCL_ENCODING_PROFILE_SET(statePtr->inputEncodingFlags, profile);
- TCL_ENCODING_PROFILE_SET(statePtr->outputEncodingFlags, profile);
- ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR);
- return TCL_OK;
} else if (HaveOpt(2, "-eofchar")) {
if (!newValue[0] || (!(newValue[0] & 0x80) && (!newValue[1]
#ifndef TCL_NO_DEPRECATED
@@ -8221,6 +8212,15 @@ Tcl_SetChannelOption(
ResetFlag(statePtr, CHANNEL_EOF|CHANNEL_STICKY_EOF|CHANNEL_BLOCKED);
statePtr->inputEncodingFlags &= ~TCL_ENCODING_END;
return TCL_OK;
+ } else if (HaveOpt(1, "-profile")) {
+ int profile;
+ if (TclEncodingProfileNameToId(interp, newValue, &profile) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ TCL_ENCODING_PROFILE_SET(statePtr->inputEncodingFlags, profile);
+ TCL_ENCODING_PROFILE_SET(statePtr->outputEncodingFlags, profile);
+ ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR);
+ return TCL_OK;
} else if (HaveOpt(1, "-translation")) {
const char *readMode, *writeMode;