Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Fri, 27 Jul 2001 20:57:13 +0400 From: egor duda X-Mailer: The Bat! (v1.53 RC/4) Reply-To: egor duda Organization: deo X-Priority: 3 (Normal) Message-ID: <23293696332.20010727205713@logos-m.ru> To: Mike Gingell CC: cygwin AT cygwin DOT com Subject: Re: Cannot change console mode when set CYGWIN=tty In-Reply-To: <5.1.0.14.0.20010727130257.00a8bfe0@mail.accesswave.ca> References: <5 DOT 1 DOT 0 DOT 14 DOT 0 DOT 20010727130257 DOT 00a8bfe0 AT mail DOT accesswave DOT ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! Friday, 27 July, 2001 Mike Gingell mgingell AT accesswave DOT ca wrote: MG> I wish life was so simple. If I was only developing in cygwin/Unix, I MG> would have trashed all of the MS stuff long ago.... MG> I agree with your solutions and appreciate your recommendations. However, MG> I need to be able to compile this code using "native" tools so that I can MG> deliver the source to my other users that have never had the fortune to MG> work with cygwin (and Unix) and only have MSVC... I only run the tests in MG> cygwin/bash because it is so much better/convenient than cmd.exe. I guess MG> for testing this stuff, I will have to create an instance that doesn't set MG> CYGWIN=tty. (Or find a way to break the pipe and reopen the STDIN handle MG> in windows, although I doubt this will work ...) imagine you're running your program via telnet or ssh. In this case, "real" console and your program may be on different hosts! so i doubt there's a way to "break the pipe" to choose at compile time, you can use ifdefs. #ifdef WIN32_CONSOLE /* win32-style console handling code */ #else /* unix-style console handling code */ #endif at runtime -- isatty(), as Troy suggested. MG> At 07:47 AM 7/27/2001 -0600, you wrote: >>I would also consider leaving your old code intact and >>using isatty() to toggle between the older console >>code and the new technique that Egor suggests. >> >>Such as: >> >>if (isatty()) { >> /* use tty-style handling here */ >>} else { >> /* your old console-style code here */ >>} >> >>That way if a user does not set CYGWIN=tty >>your code will continue to work in either case. Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19 -- 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/