delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/11/29/11:50:47

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL
X-Spam-Check-By: sourceware.org
Message-ID: <50B79229.9020304@kouptsov.com>
Date: Thu, 29 Nov 2012 11:49:45 -0500
From: Konstantin Kouptsov <konstantin AT kouptsov DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: isatty gives wrong result via ssh
References: <50B385F9 DOT 80103 AT kouptsov DOT com> <20121126160446 DOT GB3800 AT calimero DOT vinschen DOT de>
In-Reply-To: <20121126160446.GB3800@calimero.vinschen.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Your example code was very helpful.

A followup question. My Windows application works with the Windows Console API, and uses functions such as GetConsoleMode/SetConsoleMode, GetConsoleScreenBufferInfo, SetConsoleCursorPosition, ScrollConsoleScreenBuffer etc. When I connect via ssh from Linux to the Windows box running Cygwin sshd, and then laungh this application, none of these apparently work. Same if I connect from one Windows/Cygwin box to another Windows/Cygwin box and run it.

Presumably, here, I should be using a Unix-like console control interface, and link against ncurses port, provided with Cygwin. Are there examples/documentation on that? Which libraries should my application link against? What is the standard way to check if and where the Cygwin is installed? (I need that to make sure ncurses are available.)

Also, I see there are test executable in lib/ncurses/test. Where can I see the source code for them?

Thanks.


On 11/26/2012 11:04 AM, Corinna Vinschen wrote:
> On Nov 26 10:08, Konstantin Kouptsov wrote:
>> On Windows, if I compile it using a Microsoft compiler:
>>
>> C: > cl /out:checktty.exe checktty.c
>>
>> the program behaves correctly when I run it from a DOS prompt or from a Cywin's bash prompt. However, if I connect to the Windows computer running Cygwin's sshd service from another Linux or Windows computer, it always gives the same result:
>>
>> $ ./checktty.exe
>> not a tty
>>
>> $ ./checktty.exe < checktty.c
>> not a tty
>>
>> (When I compile with Cygwin's gcc, everything is fine)
>>
>> What happens here?
> 
> Cygwin pseudo ttys are implemented as pipes, and the msvcrt runtime
> has no idea about that.  It sees a pipe and that's no tty from its
> POV.
> 
>> Given that I must compile the program using Microsoft's compiler on Windows, how this can be worked around?
> 
> The workaround is to implement your own isatty function which recognizes
> Cygwin pseudo ttys as well.  I had a customer asking this question, too,
> at one point and I sent them example code.  I attached it to this mail.
> 
> 
> HTH,
> Corinna
> 




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019