public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: _kbhit
@ 2006-02-13 17:18 Michiel De Hoon
  2006-02-13 18:12 ` _kbhit Christopher Faylor
  2006-02-13 18:50 ` _kbhit Dave Korn
  0 siblings, 2 replies; 11+ messages in thread
From: Michiel De Hoon @ 2006-02-13 17:18 UTC (permalink / raw)
  To: cygwin

Gary R. Van Sickle wrote:
> > First, some Cygwin programs will need _kbhit to be 
> > able to interact with the Windows OS.
> 
> That's simply not true.  They may *want* it so that they can interact with
> cmd.exe, in which case they're not a "Cygwin program".

If:
1) A program needs to run a Windows message loop;
2) This message loop should be exited when user input is available on stdin;
3) The program needs to link to cygwin1.dll;
then it is a Cygwin program that needs _kbhit (either present in the DLL or
implemented by myself using select()), isn't it?

--Michiel.

Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <6CA15ADD82E5724F88CB53D50E61C9AE9ECE5E@cgcmail.cgc.cpmc.co  lumbia.edu>]
* Re: _kbhit
@ 2006-02-11  0:19 Michiel De Hoon
  2006-02-11  5:11 ` _kbhit Gary R. Van Sickle
  0 siblings, 1 reply; 11+ messages in thread
From: Michiel De Hoon @ 2006-02-11  0:19 UTC (permalink / raw)
  To: cygwin

> On Sun, Feb 05, 2006 at 01:17:33PM -0500, Michiel De Hoon wrote:
> >For one of my software projects, I need the _kbhit function to check the
> >console for keyboard input. While this function is present in msvcrt.dll,
it
> >is missing from cygwin1.dll, so I started writing this function myself
(I'm
> >hoping to contribute it to Cygwin if it works well).
>
> I really appreciate the sentiment of submitting code but _kbhit is not a
> linux function (or <echo on>POSIX, POSIX, POSIX...</echo off>) so it
> really isn't a candidate for inclusion in the Cygwin DLL.
> 
> cgf
>
Even though _kbhit is not a POSIX function, I think a valid argument can be
made to include it in Cygwin anyway.

First, some Cygwin programs will need this function to be able to interact
with the Windows OS. Second, as the Cygwin DLL is a replacement for msvcrt
(and msvcrt.dll and cygwin1.dll cannot be used together), developers may
expect to find the same functionality in cygwin1.dll as in msvcrt.dll.
Whereas it is possible for each developer to add needed functions missing in
cygwin1.dll to their own source code, it will lead to ugly #ifdef __CYGWIN__
statements and complicate porting Windows programs to Cygwin (which is what I
am effectively doing). Finally, coding the _kbhit function is not entirely
straightforward: simply doing a select() on file descriptor 0 is inconsistent
with _kbhit in msvcrt if stdin is redirected.

So, .... if I was able to convince you, I'd be happy to submit a patch. If
not, ... well for my own project a kbhit() function based on select() is
sufficient, so that'll work for me at least.

--Michiel.

Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-02-18 21:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 17:18 _kbhit Michiel De Hoon
2006-02-13 18:12 ` _kbhit Christopher Faylor
2006-02-13 18:50 ` _kbhit Dave Korn
2006-02-14  4:00   ` _kbhit skaller
     [not found] <6CA15ADD82E5724F88CB53D50E61C9AE9ECE5E@cgcmail.cgc.cpmc.co  lumbia.edu>
2006-02-16  1:48 ` _kbhit Arend-Jan Westhoff
2006-02-16  7:17   ` _kbhit Gary R. Van Sickle
2006-02-17 20:49     ` _kbhit Shankar Unni
2006-02-17 20:51       ` _kbhit Christopher Faylor
2006-02-18 21:30       ` _kbhit Gary R. Van Sickle
  -- strict thread matches above, loose matches on Subject: below --
2006-02-11  0:19 _kbhit Michiel De Hoon
2006-02-11  5:11 ` _kbhit Gary R. Van Sickle

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