This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin 1.3.21 breaks ssh terminal interaction


try using an AllocConsole() in your non-Cygwin app and in your Cygwin app, 
like so:

#include <windows.h>
#include <io.h>
#include <stdio.h>
#include <fcntl.h>

// STC for the phantom console 1.3.21-1 problem
inline void OpenConsole(void)
{
   int hCrt;
   FILE * hf;

   if (AllocConsole())
   {
      #ifndef __CYGWIN__
      hCrt = _open_osfhandle((long)GetStdHandle(STD_ERROR_HANDLE), 
_O_TEXT);
      hf = _fdopen( hCrt, "w" );
      #else
      hf = fdopen( 2, "w" );
      #endif
      *stderr = *hf;
      setvbuf( stderr, NULL, _IONBF, 0 );
      #ifndef __CYGWIN__
      hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), 
_O_TEXT);
      hf = _fdopen( hCrt, "w" );
      #else
      hf = fdopen( 1, "w" );
      #endif
      *stdout = *hf;
      setvbuf( stdout, NULL, _IONBF, 0 );
   }
}

int main(void)
{
	OpenConsole();
	
	printf("Hello, world!\n");
	
	return(0);
}

Compile this with -mno-cygwin and without it, and run it from cmd. The 
Cygwin app will allocate a new console, the native app won't.

Is that the STC you were looking for (or is it not the right problem)?

rlc


On Fri, 14 Mar 2003, Rolf Campbell wrote:

> Corinna Vinschen wrote:
> > On Fri, Mar 14, 2003 at 03:48:40PM +0100, Loewis Martin von wrote:
> > 
> >>After upgrading to the latest cygwin, ssh won't ask me 
> >>for a password anymore in the terminal window that WinCVS
> >>1.3.12.1 opens. I have confirmed that this is the cause
> >>of the problem by reverting cygwin to 1.3.20.
> >>
> >>The same happens when I run WinCVS' cvs.exe in a terminal
> >>window.
> > 
> > 
> > WFM with cvs from the Cygwin distro.
> > 
> > Corinna
> 
> I'll speculate that this is the same problem that I've seen using Emacs. 
>   If everything is CygWin, then everything works just dandy.  But, 
> something happens when a cygwin program runs a non-cygwin program (or 
> vice-versa):  The launched app will disregard it's parent's "console" 
> and create it's own.
> 
> I've been trying to reproduce it with some relatively simple -mno-cygwin 
> app, but so far, I've been unable to make any progress.
> 
> -Rolf
> 
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]