Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!wuarchive!emory!hubcap!gatech!mcnc!rti!dg-rtp!dg-rtp.dg.com!hagins From: hagins@dg-rtp.dg.com (Jody Hagins) Newsgroups: comp.lang.c Subject: Re: Curses question Message-ID: <1990Nov28.145052.6655@dg-rtp.dg.com> Date: 28 Nov 90 14:50:52 GMT References: <1990Nov26.222916.11634@odin.corp.sgi.com> Sender: usenet@dg-rtp.dg.com (Usenet Administration) Reply-To: hagins@dg-rtp.dg.com (Jody Hagins) Distribution: na Organization: Data General Corporation, Research Triangle Park, NC Lines: 84 In article <1990Nov26.222916.11634@odin.corp.sgi.com>, bowen@wanda.SGI.COM (Jerre Bowen) writes: |> |> Michael Hart writes: |> > |> > Anyway, the prog quits with a ctl-C, and is supposed to clear the |> > screen. I've tried werase(stdscr), wclear(stdscr), and with & without |> > a wrefresh(stdscr). Am I being brain-dead, or is something funky |> > with curses on SGI? |> > |> > #include |> > |> > main() |> > { |> > char *theStr = "Hello, World! Using Curses!!\n"; |> > chtype theInput; |> > int repCtr = 0; |> > |> > /* some curses initialization items first |> > init the curses code |> > call character mode for input (cbreak) |> > set noecho |> > set to clear input buffer on an interrupt intrflus |> > */ |> > initscr(); |> > cbreak(); |> > noecho(); |> > intrflush(); |> > nodelay(stdscr,TRUE); |> > scrollok(stdscr,TRUE); |> > |> > theInput = wgetch(stdscr); |> > while ( theInput != KEY_END) { |> > addstr(theStr); |> > repCtr++; |> > wprintw(stdscr,"%d \n",repCtr); |> > theInput = wgetch(stdscr); |> > } |> > wclear(stdscr); |> > wrefresh(stdscr); |> > endwin(); |> > } |> |> > Michael G. Hart hart@blackjack.dt.navy.mil / mhart@oasys.dt.navy.mil |> > |> |> cbreak() mode delivers characters to the program one by one, but |> interrupt characters still cause signals to be sent the program, so when |> you -c the program (as you say above if I understand correctly) |> the process is terminated unnaturally via a SIGINT and therefore never |> hits the wclear() and etc. You must catch SIGINT (using sigset(), for |> example) if you intend to use -c as the termination sequence. I |> think there are other bugs in this program, however, just glancing at |> the curses man page--initscr() needs some parameters and I don't think |> using KEY_END is legit without first initializing the keypad. |> |> |> Jerre Bowen |> bowen@sgi.com I believe that going into raw mode will interrupt the ctrl-c (and all other keys) and send them straight to the program for processing. -- Jody Hagins hagins@dg-rtp.dg.com Data General Corp. 62 Alexander Dr. RTP, N.C. 27709 (919) 248-6035