public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Pavel Fedin <p.fedin@samsung.com>
To: 'Andy Koppe' <andy.koppe@gmail.com>
Cc: cygwin@cygwin.com
Subject: RE: BLODA extension: console interoperability
Date: Fri, 26 Jul 2013 14:59:00 -0000	[thread overview]
Message-ID: <003601ce89f8$c3845f10$4a8d1d30$%fedin@samsung.com> (raw)
In-Reply-To: <CAHWeT-bBvWyv0dzFkwbgyKJKuNyaVY85ZBkksCC-Qs_dZ6H+GA@mail.gmail.com>

 Hello!

> I don't think that's fair, since such apps were designed for the
> Windows console, without being aware of Cygwin's pipe-based ptys. And
> unfortunately that list would be very long anyway: basically anything
> interactive that hasn't been explicitly adapted to Cygwin ptys

 Let me also drop my 5 cents into this...
 We should be very careful about this. At least there is one case where difference between Cygwin console and real Windows console plays a key role: ncurses. Normal Windows console is very basic and does not understand 90% of control sequences. As a result, ncurses has been extended with 'terminal drivers', which redirect certain control functions to OS (Windows in our case) API calls. Which, of course, work only with real Windows console.
 So, it's crucial to be able to detect whether we are running on Windows console or not. Here i have patched version of ncurses which uses GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &mode) operation in order to detect this. This function returns error on non-console handles. This makes ncurses working from within MSYS console. Previously an attempt to run ncurses app simply trashed my console window with ESC sequences. Original ncurses relies on $TERM variable being empty, which works well with 'naked' cmd.exe,  but fails miserably with MSYS environment because MSYS sets $TERM to 'cygwin', while still operating inside Windows console which does not really understand most of ESC sequences.
 With this fix applications can correctly determine whether they are running in Cygwin's shell and even over ssh connection, and correctly render in all these cases.

 P.S. There is still a problem with input in these applications if run from non-native console, but i think it's another story. I didn't look at it because of lack of time and motivation. The goal was to cross-compile an ncurses app for Windows here at work, and the goal was reached.

 P.P.S. The patch is lying around and waiting to be submitted. I know, not here, but likely to ncurses ML directly. However looks like FSF guys are not very keen on people committing to them, and they perhaps worry about legal-mumbo-jumbo much more than about programming and real openess. My two patches sent to different lists (make and gnulib) were simply ignored.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia



--
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

  parent reply	other threads:[~2013-07-26 12:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 23:07 Warren Young
2013-07-26  2:50 ` Larry Hall (Cygwin)
2013-07-26  4:44   ` Warren Young
2013-07-26  5:02     ` Larry Hall (Cygwin)
2013-07-26  5:20     ` Andy Koppe
2013-07-26  6:13       ` Warren Young
2013-07-26  6:44       ` Christopher Faylor
2013-07-26 14:59       ` Pavel Fedin [this message]
2013-07-26 16:22         ` Christopher Faylor
2013-07-27  3:18           ` Charles Wilson
2013-07-29  9:06           ` Pavel Fedin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003601ce89f8$c3845f10$4a8d1d30$%fedin@samsung.com' \
    --to=p.fedin@samsung.com \
    --cc=andy.koppe@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).