Mail Archives: cygwin/2001/07/27/13:10:33
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/
- Raw text -