summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2002-02-27 18:53:26 (GMT)
committerandreas_kupries <akupries@shaw.ca>2002-02-27 18:53:26 (GMT)
commite614e9de5c5d3ddc9b8646a48c60a009f874014a (patch)
treeec12f3d32c467adfb52ee82623d134f09f3947fc
parentaecbfcbc577e8878d56306bf7cd4e8de1305c4f4 (diff)
downloadtcl-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.
-rw-r--r--ChangeLog29
-rw-r--r--unix/tclUnixChan.c10
2 files changed, 28 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 50c59c9..3e44525 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,32 +1,43 @@
+2002-02-27 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * 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.
+
2002-02-26 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tclCmdAH.c (StoreStatData): corrected mem leak.
* generic/tclCmdMZ.c (Tcl_RegsubObjCmd): prevent obj leak in
- remedial regsub case.
+ remedial regsub case.
* generic/tclFileName.c (Tcl_TranslateFileName): decr refcount for
- error case to prevent mem leak.
+ error case to prevent mem leak.
* generic/tclVar.c (Tcl_ArrayObjCmd): removed extra obj allocation.
* unix/tclUnixSock.c (Tcl_GetHostName): added an extra
- gethostbyname check to guard against failure with truncated names
- returned by uname.
+ gethostbyname check to guard against failure with truncated
+ names returned by uname.
* unix/configure:
* unix/tcl.m4 (SC_SERIAL_PORT): added sys/modem.h check and defined
- _XOPEN_SOURCE_EXTENDED for HP-11 to get updated header decls.
+ _XOPEN_SOURCE_EXTENDED for HP-11 to get updated header decls.
* unix/tclUnixChan.c: added Unix implementation of TIP #35, serial
- port support. [Patch #438509] (schroedter)
+ port support. [Patch #438509] (schroedter)
2002-02-26 Miguel Sofer <msofer@users.sourceforge.net>
* generic/tclCmpCmds.c: (bugfix to the bugfix, hopefully the last)
- Bugfix to the new [for] compiling code: was setting a exceptArray
- parameter using another param which wasn't yet initialised, thus
- filling it with noise.
+ Bugfix to the new [for] compiling code: was setting a
+ exceptArray parameter using another param which wasn't yet
+ initialised, thus filling it with noise.
2002-02-25 Andreas Kupries <andreas_kupries@users.sourceforge.net>
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