cancel
Showing results for 
Search instead for 
Did you mean: 

Keyboard Hit

Mauricio Batista
Occasional Contributor

Keyboard Hit

Thereis a command or function in the HP-UX Release 10 like the function kbhit() in the C languages for use in scrips shells programming?
4 REPLIES
Andreas Voss
Honored Contributor

Re: Keyboard Hit

Hi,

there is no command for this at HP-UX.
Put you a C source at attachment that will do it.

Regards
Dave Kelly_1
Respected Contributor

Re: Keyboard Hit

There is some sample C code in the Unix programming FAQ at

http://www.landfield.com/faqs/unix-faq/programmer/faq/

Question 3.3 is the one to look at.
Ralph Grothe
Honored Contributor

Re: Keyboard Hit

Would switching the terminal to raw mode in order to get the unbuffered keyboard input be of help?

Then maybe you could do something like:

echo 'hit key to continuec'
stty raw -echo
byte=`dd count=1 bs=1 2>/dev/null`
stty -raw echo
echo 'nnext statement'

But make sure to read the WARNINGS stanza in the stty manpage.

HTH
Ralph


P.S.
I apologize if this reply appears twice, but somehow the forum's webserver didn't swallow my first posting.
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Keyboard Hit

Sorry,

forgot to escape the backslash for \c at the end of the 1st echo statement as to make it visible in this forum.
Madness, thy name is system administration