diff options
author | andreas_kupries <akupries@shaw.ca> | 2002-02-27 18:53:26 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2002-02-27 18:53:26 (GMT) |
commit | e614e9de5c5d3ddc9b8646a48c60a009f874014a (patch) | |
tree | ec12f3d32c467adfb52ee82623d134f09f3947fc /unix/tclUnixChan.c | |
parent | aecbfcbc577e8878d56306bf7cd4e8de1305c4f4 (diff) | |
download | tcl-e614e9de5c5d3ddc9b8646a48c60a009f874014a.zip tcl-e614e9de5c5d3ddc9b8646a48c60a009f874014a.tar.gz tcl-e614e9de5c5d3ddc9b8646a48c60a009f874014a.tar.bz2 |
* unix/tclUnixChan.c (TclpOpenFileChannel): Added code to regonize
"/dev/tty" (by name) and to not handle it as tty / serial
line. This is the controlling terminal and is special. Setting
it into raw mode as is done for other tty's is a bad idea. This
is a hackish fix for expect SGF Bug #520624. The fix has
limitation: Tcl_MakeFileChannel handles tty's specially too, but
is unable to recognize /dev/tty as it only gets a file
descriptor, and no name for it.
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 3110478..0ed2a00 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.30 2002/02/26 20:03:05 hobbs Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.31 2002/02/27 18:53:26 andreas_kupries Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -1690,6 +1690,9 @@ TclpOpenFileChannel(interp, pathPtr, modeString, permissions) CONST char *native, *translation; char channelName[16 + TCL_INTEGER_SPACE]; Tcl_ChannelType *channelTypePtr; +#ifdef SUPPORTS_TTY + int ctl_tty; +#endif #ifdef DEPRECATED ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); #endif @@ -1721,6 +1724,9 @@ TclpOpenFileChannel(interp, pathPtr, modeString, permissions) return NULL; } fd = Tcl_PlatformOpen(native, mode, permissions); +#ifdef SUPPORTS_TTY + ctl_tty = (strcmp (native, "/dev/tty") == 0); +#endif if (fd < 0) { if (interp != (Tcl_Interp *) NULL) { @@ -1741,7 +1747,7 @@ TclpOpenFileChannel(interp, pathPtr, modeString, permissions) sprintf(channelName, "file%d", fd); #ifdef SUPPORTS_TTY - if (isatty(fd)) { + if (!ctl_tty && isatty(fd)) { /* * Initialize the serial port to a set of sane parameters. * Especially important if the remote device is set to echo and |