diff options
| author | andreask@activestate.com <andreas_kupries> | 2002-02-27 18:53:26 (GMT) | 
|---|---|---|
| committer | andreask@activestate.com <andreas_kupries> | 2002-02-27 18:53:26 (GMT) | 
| commit | 07460254978af97fc296192f284385f52ac1ca3c (patch) | |
| tree | ec12f3d32c467adfb52ee82623d134f09f3947fc /unix/tclUnixChan.c | |
| parent | 920952db5d15fa6c92c05cc2bd78dab680f78d96 (diff) | |
| download | tcl-07460254978af97fc296192f284385f52ac1ca3c.zip tcl-07460254978af97fc296192f284385f52ac1ca3c.tar.gz tcl-07460254978af97fc296192f284385f52ac1ca3c.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  | 
