From owner-freebsd-hackers Tue Jun 24 19:08:58 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA23297 for hackers-outgoing; Tue, 24 Jun 1997 19:08:58 -0700 (PDT) Received: from uw2cs003.cuscal.com.au (proxy.cuscal.com.au [168.217.251.201]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA23288 for ; Tue, 24 Jun 1997 19:08:50 -0700 (PDT) Message-Id: <199706250208.TAA23288@hub.freebsd.org> Received: from nt2cs006.cuscal.com.au ([168.217.2.1]) by uw2cs003.cuscal.com.au (Netscape Mail Server v2.02) with ESMTP id AAA11489 for ; Wed, 25 Jun 1997 12:08:15 +1000 Received: by nt2cs006.cuscal.COM.AU with Internet Mail Service (5.0.1457.3) id ; Wed, 25 Jun 1997 12:07:25 +1000 From: MARK SAYER To: "'freebsd-hackers@freebsd.org'" Subject: RE: BSD io Date: Wed, 25 Jun 1997 12:07:47 +1000 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1457.3) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.freebsd.org id TAA23292 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I have been looking for this for ages. I resorted to using ncurses, but then I was stuck with using ncurses window management (yuk). So, I tried the code below and it doesn't seem to work as promised. I just want the program to trap 1 keypress and continue execution. #include #include struct termios old, new; main() { char c; tcgetattr (fileno(stdin), &old); new = old; new.c_iflag &=~(ICANON|ECHO); tcsetattr (fileno(stdin), TCSANOW, &new); c = getc(stdin); tcsetattr (fileno(stdin), TCSANOW, &old); } All it seems to do is stop trapping my CR key?? 168: {9} ./a.out a^M^M^M^Mò 168: {10} the ò is a CBREAK. I'm running FreeBSD 2.1.6. Any ideas? > ---------- > From: Tim Vanderhoek[SMTP:hoek@hwcn.org] > Sent: Tuesday, June 24, 1997 11:36 PM > To: Tim Vanderhoek > Cc: Steve Howe; freebsd-hackers > Subject: Re: BSD io > > On Tue, 24 Jun 1997, Tim Vanderhoek wrote: > > > #include > > #include > > struct termios old, new; > > main(){ > > tcgetattr (fileno(stdin), &old); new = old; > > new &= ~(ICANON|ECHO); > > new.c_lflag &= ~(ICANON|ECHO); > > Actually, FWIW, I like the section the GNU C library reference > manual has on this. Easier, more on-topic, and nicer than man 4 > termios. The manual is on the web in html (search Yahoo, "GNU > Info"), if anyone cares... > > > -- > Outnumbered? Maybe. Outspoken? Never! > tIM...HOEk >