Seth Woolley's Man Viewer

cbreak(3x) - cbreak, echo, halfdelay, intrflush, keypad, meta, nocbreak, nodelay, noecho, noqiflush, noraw, notimeout, qiflush, raw, timeout, typeahead, wtimeout - curses input options - man 3x cbreak

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

curs_inopts(3X)                                                curs_inopts(3X)



NAME
       cbreak,  nocbreak,  echo(1,3x,1 builtins),  noecho,  halfdelay, intrflush, keypad, meta,
       nodelay, notimeout, raw(3x,7,8,3x cbreak), noraw, noqiflush, qiflush, timeout(1,3x,3x cbreak),  wtimeout,
       typeahead - curses input options

SYNOPSIS
       #include <curses.h>

       int cbreak(void);
       int nocbreak(void);
       int echo(1,3x,1 builtins)(void);
       int noecho(void);
       int halfdelay(int tenths);
       int intrflush(WINDOW *win, bool bf);
       int keypad(WINDOW *win, bool bf);
       int meta(WINDOW *win, bool bf);
       int nodelay(WINDOW *win, bool bf);
       int raw(3x,7,8,3x cbreak)(void);
       int noraw(void);
       void noqiflush(void);
       void qiflush(void);
       int notimeout(WINDOW *win, bool bf);
       void timeout(1,3x,3x cbreak)(int delay);
       void wtimeout(WINDOW *win, int delay);
       int typeahead(int fd);

DESCRIPTION
       Normally,  the  tty(1,4)  driver buffers typed characters until a newline or
       carriage return is typed.  The cbreak routine disables  line  buffering
       and erase/kill(1,2,1 builtins) character-processing (interrupt and flow control charac-
       ters are unaffected), making characters typed by the  user  immediately
       available to the program.  The nocbreak routine returns the terminal to
       normal (cooked) mode.

       Initially the terminal may or may not be in(1,8) cbreak mode, as the mode is
       inherited;  therefore, a program should call cbreak or nocbreak explic-
       itly.  Most interactive programs using  curses  set(7,n,1 builtins)  the  cbreak  mode.
       Note  that  cbreak overrides raw(3x,7,8,3x cbreak).  [See curs_getch(3X) for a discussion
       of how these routines interact with echo(1,3x,1 builtins) and noecho.]

       The echo(1,3x,1 builtins) and noecho routines control whether characters  typed  by  the
       user  are echoed by getch as they are typed.  Echoing by the tty(1,4) driver
       is always disabled, but initially getch is in(1,8) echo(1,3x,1 builtins) mode, so  characters
       typed  are  echoed.   Authors of most interactive programs prefer to do
       their own echoing in(1,8) a controlled area of the screen, or not to echo(1,3x,1 builtins) at
       all,  so  they  disable echoing by calling noecho.  [See curs_getch(3X)
       for a discussion  of  how  these  routines  interact  with  cbreak  and
       nocbreak.]

       The  halfdelay routine is used for half-delay mode, which is similar to
       cbreak mode in(1,8) that characters typed by the user are immediately avail-
       able to the program.  However, after blocking for tenths tenths of sec-
       onds, ERR is returned if(3,n) nothing has been typed.  The value  of  tenths
       must  be  a number between 1 and 255.  Use nocbreak to leave half-delay
       mode.

       If the intrflush option is enabled, (bf is TRUE), when an interrupt key
       is  pressed  on the keyboard (interrupt, break, quit) all output in(1,8) the
       tty(1,4) driver queue(1,3) will be flushed, giving the effect of faster  response
       to  the interrupt, but causing curses to have the wrong idea of what is
       on the screen.  Disabling (bf is FALSE), the option prevents the flush.
       The  default  for the option is inherited from the tty(1,4) driver settings.
       The window argument is ignored.

       The keypad option enables  the  keypad  of  the  user's  terminal.   If
       enabled  (bf  is  TRUE),  the user can press a function key (such as an
       arrow key) and wgetch returns a single value representing the  function
       key,  as in(1,8) KEY_LEFT.  If disabled (bf is FALSE), curses does not treat
       function keys specially and the program has  to  interpret  the  escape
       sequences itself.  If the keypad in(1,8) the terminal can be turned on (made
       to transmit) and off (made to work locally),  turning  on  this  option
       causes  the terminal keypad to be turned on when wgetch is called.  The
       default value for keypad is false.

       Initially, whether the terminal returns 7  or  8  significant  bits  on
       input  depends  on  the control mode of the tty(1,4) driver [see termio(7)].
       To force 8 bits to be returned, invoke meta(win, TRUE); this is equiva-
       lent, under POSIX, to setting the CS8 flag on the terminal.  To force 7
       bits to be returned, invoke meta(win, FALSE); this is equivalent, under
       POSIX,  to  setting the CS7 flag on the terminal.  The window argument,
       win, is always ignored.  If the terminfo capabilities smm (meta_on) and
       rmm  (meta_off) are defined for the terminal, smm is sent to the termi-
       nal when meta(win, TRUE) is called  and  rmm  is  sent  when  meta(win,
       FALSE) is called.

       The nodelay option causes getch to be a non-blocking call.  If no input
       is ready, getch returns ERR.  If disabled (bf is  FALSE),  getch  waits
       until a key is pressed.

       While  interpreting an input escape sequence, wgetch sets a timer while
       waiting for the next character.  If  notimeout(win,  TRUE)  is  called,
       then  wgetch  does  not  set(7,n,1 builtins) a timer.  The purpose of the timeout(1,3x,3x cbreak) is to
       differentiate between sequences received from a function key and  those
       typed by a user.

       The  raw(3x,7,8,3x cbreak) and noraw routines place the terminal into or out of raw(3x,7,8,3x cbreak) mode.
       Raw mode is similar to cbreak mode, in(1,8) that characters typed are  imme-
       diately  passed  through to the user program.  The differences are that
       in(1,8) raw(3x,7,8,3x cbreak) mode, the interrupt, quit, suspend, and flow control  characters
       are  all  passed through uninterpreted, instead of generating a signal.
       The behavior of the BREAK key depends on other bits in(1,8) the  tty(1,4)  driver
       that are not set(7,n,1 builtins) by curses.

       When  the  noqiflush  routine is used, normal flush(8,n) of input and output
       queues associated with the INTR, QUIT and SUSP characters will  not  be
       done  [see  termio(7)].   When  qiflush  is  called, the queues will be
       flushed when these control characters are read.  You may want  to  call
       noqiflush()  in(1,8)  a  signal(2,7)  handler  if(3,n)  you want output to continue as
       though the interrupt had not occurred, after the handler exits.

       The timeout(1,3x,3x cbreak) and wtimeout routines set(7,n,1 builtins) blocking or non-blocking read(2,n,1 builtins) for
       a  given  window.   If  delay is negative, blocking read(2,n,1 builtins) is used (i.e.,
       waits indefinitely for input).  If delay  is  zero,  then  non-blocking
       read(2,n,1 builtins) is used (i.e., read(2,n,1 builtins) returns ERR if(3,n) no input is waiting).  If delay
       is positive, then read(2,n,1 builtins) blocks for delay milliseconds, and  returns  ERR
       if(3,n)  there  is  still  no input.  Hence, these routines provide the same
       functionality as nodelay, plus the additional capability of being  able
       to block for only delay milliseconds (where delay is positive).

       The  curses  library does ``line-breakout optimization'' by looking for
       typeahead periodically while updating the screen.  If input  is  found,
       and  it  is  coming  from  a tty(1,4), the current update(7,n) is postponed until
       refresh or doupdate is called again.  This allows  faster  response  to
       commands  typed in(1,8) advance.  Normally, the input FILE pointer passed to
       newterm, or stdin in(1,8) the case that initscr was used, will be used to do
       this typeahead checking.  The typeahead routine specifies that the file(1,n)
       descriptor fd is to be used to check for typeahead instead.  If  fd  is
       -1, then no typeahead checking is done.

RETURN VALUE
       All  routines  that  return  an  integer return ERR upon failure and OK
       (SVr4 specifies only "an integer value other than ERR") upon successful
       completion,  unless  otherwise  noted in(1,8) the preceding routine descrip-
       tions.

PORTABILITY
       These functions are described in(1,8) the XSI Curses standard, Issue 4.

       The ncurses library obeys the XPG4 standard and the historical practice
       of  the  AT&T  curses  implementations, in(1,8) that the echo(1,3x,1 builtins) bit is cleared
       when curses initializes the terminal state.  BSD curses  differed  from
       this  slightly;  it left the echo(1,3x,1 builtins) bit on at initialization, but the BSD
       raw(3x,7,8,3x cbreak) call turned it off as a side-effect.   For  best  portability,  set(7,n,1 builtins)
       echo(1,3x,1 builtins)  or noecho explicitly just after initialization, even if(3,n) your pro-
       gram remains in(1,8) cooked mode.

NOTES
       Note that echo(1,3x,1 builtins), noecho, halfdelay, intrflush, meta, nodelay, notimeout,
       noqiflush, qiflush, timeout(1,3x,3x cbreak), and wtimeout may be macros.

       The  noraw  and  nocbreak calls follow historical practice in(1,8) that they
       attempt to restore to normal (`cooked') mode from raw(3x,7,8,3x cbreak) and cbreak  modes
       respectively.   Mixing raw(3x,7,8,3x cbreak)/noraw and cbreak/nocbreak calls leads to tty(1,4)
       driver control states that are hard to predict or understand; it is not
       recommended.

SEE ALSO
       curses(3X), curs_getch(3X), curs_initscr(3X), termio(7)



                                                               curs_inopts(3X)

References for this manual (incoming links)