cbreak mode

neil at sunybcs.UUCP neil at sunybcs.UUCP
Mon Jan 26 15:53:04 AEST 1987


In article <194 at nbc1.UUCP> abs at nbc1.UUCP (Andrew Siegel) writes:
>> ... I found that the program
>> 
>> #include <stdio.h>
>> #include <curses.h>
>> 
>> main()
>> {
>>    cbreak();
>>    nocbreak();
>> }
>> 
>> would leave the machine in cbreak mode.  
>If you're using curses, you must begin your program with a call to
>initscr(), and terminate it with endwin().  The endwin() call returns
>the tty parameters to their original setting.

The function initscr() needs to be called before screen and window
functions only.  cbreak() and nocbreak() are not screen or window
functions so it shouldn't have to be called.  Calling endwin() does
call resetty() which does restore the terminal settings but nocbreak()
should take the terminal out of cbreak mode.  As far as why this
doesn't work...  I dunno;  I have found problems like this before with
curses and terminal modes and have managed to avoid them but never fix
them.

				Neil



Neil Smithline				CSnet:  neil at buffalo
ARPA:	neil.buffalo at rand-relay		Bitnet: NEIL at SUNYBCS
uucp:   {decvax!watmath}
        {pur-ee!rocks34!rocksvax}
        {{allegra, seismo}!rochester!rocksvax} !sunybcs!neil



More information about the Comp.unix.questions mailing list