delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/26/08:08:24

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:cc:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=Lm+jNnAeWLTCY5ibd0/uti/yxl1OJnTsw0OHOxFFMx0
JzRPWit1KecePK8GgyAqULuOHp2UClg95Zm5dkeeEzMtwpPkM+jakFwykyoqh3WJ
ItkOsD6OayoEnGkVuEMSNCkbGJ7op8STkKncEoQDnQk6StEDKoczg0V3XlK8Gz8w
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:cc:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
s=default; bh=+OytrTsei0tBwZDXqKgh/HB/1Bs=; b=d8zS8snn3k3sOYdnV
pibF835OZy2AKn7X3FjczVAmRbbwh30Ngnkl6jxmVV1XSXA8war1kgTeCNgoVKYp
OAd7VrNzLXcOeW8GEAua8Z9ySlPaOpPUO4b4eait702R61aqyIKNewyaz9+vejvf
gTgCCUV3e2DTkjRYsom7gA1Zp4=
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
X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,SPF_HELO_PASS autolearn=no version=3.3.1
From: Pavel Fedin <p DOT fedin AT samsung DOT com>
To: "'Andy Koppe'" <andy DOT koppe AT gmail DOT com>
Cc: cygwin AT cygwin DOT com
References: <51F1A863 DOT 8060403 AT etr-usa DOT com> <51F1AF90 DOT 3080409 AT cygwin DOT com> <51F1F7B4 DOT 4060202 AT etr-usa DOT com> <CAHWeT-bBvWyv0dzFkwbgyKJKuNyaVY85ZBkksCC-Qs_dZ6H+GA AT mail DOT gmail DOT com>
In-reply-to: <CAHWeT-bBvWyv0dzFkwbgyKJKuNyaVY85ZBkksCC-Qs_dZ6H+GA@mail.gmail.com>
Subject: RE: BLODA extension: console interoperability
Date: Fri, 26 Jul 2013 16:07:55 +0400
Message-id: <003601ce89f8$c3845f10$4a8d1d30$%fedin@samsung.com>
MIME-version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r6QC8J42013272

 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


- Raw text -


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