This is the mail archive of the cygwin 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: isatty gives wrong result via ssh


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


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