Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!math.ohio-state.edu!howland.erols.net!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!newsfeed.internetmci.com!netnews.loxinfo.co.th!pc111.loxinfo.co.th!den From: den@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN (Densin Roy.) Newsgroups: comp.unix.bsd.bsdi.misc Subject: Test Key program Date: 14 Jan 1997 19:19:11 GMT Organization: Loxley Information Company Lines: 43 Message-ID: <5bgm7f$d31@netnews.loxinfo.co.th> NNTP-Posting-Host: pc111.loxinfo.co.th X-Newsreader: TIN [version 1.2 PL2] Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:5555 I have writting C-program to wait input from terminal or if timeout and print the key asci number.It work fine on Linux and Solaris.But in BSDI I have problem that when key have timeout waiting It never get my another keyboard again. This is source of my program below. Have some one suggest me to implement it on BSDI. Thank for advance Densin Roy densin@usa.net ____________________________________________________ #include <stdio.h> #include <termios.h> #include <signal.h> void main() { char key; struct termios term,term_save; printf ("Press 'q' for exit testkey program\n"); if ( isatty (0) ) { tcgetattr(0,&term_save); tcgetattr(0,&term); term.c_iflag |= ~(BRKINT | ISIG | IGNCR); term.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL); term.c_cc[VMIN] = 0; term.c_cc[VTIME] = 100; tcsetattr(0,TCSANOW,&term); } while ( key!='q') { key=getc(stdin); printf ("key='%c' ,HEX=%x \n",key,key); } tcsetattr(0,TCSANOW,&term_save); } ------------------------------------------------------------