summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-03-16 03:48:45 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-03-16 03:48:45 (GMT)
commit4d978a00ede12fc08aeddf81f4c936d533f7c9f3 (patch)
treee5c184b95f582d36eb4ca5de6f3995764b7cc8d9 /generic/tclIO.c
parentc5d053512164c62b70e4604f3836630eb8a8633d (diff)
downloadtcl-4d978a00ede12fc08aeddf81f4c936d533f7c9f3.zip
tcl-4d978a00ede12fc08aeddf81f4c936d533f7c9f3.tar.gz
tcl-4d978a00ede12fc08aeddf81f4c936d533f7c9f3.tar.bz2
Change -encodingprofile to -profile
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;