adding a kbhit() function
This commit is contained in:
@@ -11,6 +11,30 @@
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int kbhit(void)
|
||||
{
|
||||
int r, ch;
|
||||
|
||||
nodelay(stdscr, TRUE);
|
||||
noecho();
|
||||
|
||||
// check for input
|
||||
ch = getch();
|
||||
if( ch == ERR) { // no input
|
||||
r = FALSE;
|
||||
}
|
||||
else { // input
|
||||
r = TRUE;
|
||||
ungetch(ch);
|
||||
}
|
||||
|
||||
// restore block and echo
|
||||
echo();
|
||||
nodelay(stdscr, FALSE);
|
||||
|
||||
return r;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int message(char *txt)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* interface ncurses pour dd2 monitoring
|
||||
*/
|
||||
|
||||
int kbhit(void);
|
||||
|
||||
int fond_ecran(char *titre);
|
||||
int message(char *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user