Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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