Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ curses(3curses) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

terminfo(4)






       curses(3curses)                                      curses(3curses)


       NAME
             curses - CRT screen handling and optimization package

       SYNOPSIS
             cc [flag . . .] file -lcurses [library . . .]
             #include <curses.h>

       DESCRIPTION
             The curses library routines give the user a terminal-
             independent method of updating character screens with
             reasonable optimization.  A program using these routines must
             be compiled with the -lcurses option of cc.

             The curses package allows:  overall screen, window and pad
             manipulation; output to windows and pads; reading terminal
             input; control over terminal and curses input and output
             options; environment query routines; color manipulation; use
             of soft label keys; terminfo access; and access to low-level
             curses routines.

             To initialize the routines, the routine initscr or newterm
             must be called before any of the other routines that deal with
             windows and screens are used.  The routine endwin must be
             called before exiting.  To get character-at-a-time input
             without echoing (most interactive, screen-oriented programs
             want this), the following sequence should be used:

                   initscr();
                   cbreak();
                   noecho();

             Most programs would additionally use the sequence:

                   nonl();
                   intrflush(stdscr,FALSE);
                   keypad(stdscr,TRUE);

             Before a curses program is run, the tab stops of the terminal
             should be set and its initialization strings, if defined, must
             be output.  This can be done by executing the tput init
             command after the shell environment variable TERM has been
             exported.  [See terminfo(4) for further details.]

             The curses library permits manipulation of data structures,
             called windows, which can be thought of as two-dimensional
             arrays of characters.  A default window called stdscr, which


                           Copyright 1994 Novell, Inc.               Page 1













      curses(3curses)                                      curses(3curses)


            is the size of the terminal screen, is supplied.  Others may
            be created with newwin().

            Windows are referred to by variables declared as WINDOW *.
            These data structures are manipulated with routines described
            on 3curses pages (whose names begin ``curs_'').  Among the
            most basic routines are move and addch.  More general versions
            of these routines are included that allow the user to specify
            a window.

            After using routines to manipulate a window, refresh is
            called, telling curses to make the user's CRT screen look like
            stdscr.  The characters in a window are actually of type
            chtype (character and attribute data) so that other
            information about the character may also be stored with each
            character.

            Special windows called pads may also be manipulated.  These
            are windows that are not necessarily associated with a
            viewable part of the screen.  See curs_pad(3curses) for more
            information.

            In addition to drawing characters on the screen, video
            attributes and colors may be included, causing the characters
            to show up in such modes as underlined, reverse video or color
            on terminals that support such display enhancements.  Line
            drawing characters may be specified to be output.  On input,
            curses is also able to translate arrow and function keys that
            transmit escape sequences into single values.  The video
            attributes, line drawing characters and input values use
            names, defined in curses.h, such as A_REVERSE, ACS_HLINE, and
            KEY_LEFT.

            If the environment variables LINES and COLUMNS are set, or if
            the program is executing in a window environment, line and
            column information in the environment will override
            information read by terminfo.  This would affect a program
            running in a window environment, for example, where the size
            of a screen is changeable.

            If the environment variable TERMINFO is defined, any program
            using curses checks for a local terminal definition before
            checking in the standard place.  For example, if TERM is set
            to wyse150, then the compiled terminal definition is found in




                          Copyright 1994 Novell, Inc.               Page 2













       curses(3curses)                                      curses(3curses)


                   /usr/share/lib/terminfo/w/wyse150

             (The w is copied from the first letter of wyse150 to avoid
             creation of huge directories.)  However, if TERMINFO is set to
             $HOME/myterms, curses first checks

                   $HOME/myterms/w/wyse150

             and if that fails, it then checks

                   /usr/share/lib/terminfo/w/wyse150

             This is useful for developing experimental definitions or when
             write permission in /usr/share/lib/terminfo is not available.

             The integer variables LINES and COLS are defined in curses.h
             and will be filled in by initscr with the size of the screen.
             The constants TRUE and FALSE have the values 1 and 0,
             respectively.

             curses routines also define the WINDOW * variable curscr which
             is used for certain low-level operations like clearing and
             redrawing a screen containing garbage.  curscr can be used in
             only a few routines.

          International Functions
             The number of bytes and the number of columns to hold a
             character from the supplementary character set is locale-
             specific (locale category LC_CTYPE) and can be specified in
             the character class table.

             For editing, operating at the character level is entirely
             appropriate.  For screen formatting, arbitrary movement of
             characters on screen is not desirable.

             Overwriting characters (addch, for example) operates on a
             screen level.  Overwriting a character by a character that
             requires a different number of columns may produce orphaned
             columns.  These orphaned columns are filled with background
             characters.

             Inserting characters (insch, for example) operates on a
             character level (that is, at the character boundaries).  The
             specified character is inserted right before the character,
             regardless of which column of a character the cursor points
             to.  Before insertion, the cursor position is adjusted to the


                           Copyright 1994 Novell, Inc.               Page 3













      curses(3curses)                                      curses(3curses)


            first column of the character.

            As with inserting characters, deleting characters (delch, for
            example) operates on a character level (that is, at the
            character boundaries).  The character at the cursor is deleted
            whichever column of the character the cursor points to.
            Before deletion, the cursor position is adjusted to the first
            column of the character.

            A multi-column character cannot be put on the last column of a
            line.  When such attempts are made, the last column is set to
            the background character.  In addition, when such an operation
            creates orphaned columns, the orphaned columns are filled with
            background characters.

            Overlapping and overwriting a window follows the operation of
            overwriting characters around its edge.  The orphaned columns,
            if any, are handled as in the character operations.

            The cursor is allowed to be placed anywhere in a window.  If
            the insertion or deletion is made when the cursor points to
            the second or later column position of a character that holds
            multiple columns, the cursor is adjusted to the first column
            of the character before the insertion or deletion.

         Routine and Argument Names
            Many curses routines have two or more versions.  Routines
            prefixed with p require a pad argument.  Routines whose names
            contain a w generally require either a window argument or a
            wide-character argument.  If w appears twice in a routine
            name, the routine usually requires both a window and a wide-
            character argument.  Routines that do not require a pad or
            window argument generally use stdscr.

            The routines prefixed with mv require an x and y coordinate to
            move to before performing the appropriate action.  The mv
            routines imply a call to move before the call to the other
            routine.  The coordinate y always refers to the row (of the
            window), and x always refers to the column.  The upper left-
            hand corner is always (0,0), not (1,1).

            The routines prefixed with mvw take both a window argument and
            x and y coordinates.  The window argument is always specified
            before the coordinates.




                          Copyright 1994 Novell, Inc.               Page 4













       curses(3curses)                                      curses(3curses)


             In each case, win is the window affected, and pad is the pad
             affected; win and pad are always pointers to type WINDOW.

             Option setting routines require a Boolean flag bf with the
             value TRUE or FALSE; bf is always of type bool.  The variables
             ch and attrs are always of type chtype.  The types WINDOW,
             SCREEN, bool, and chtype are defined in curses.h.  The type
             TERMINAL is defined in term.h.  All other arguments are
             integers.

          Routine Name Index
             The following table lists each curses routine and the name of
             the manual page on which it is described.
             curses Routine Name    Manual Page Name
             ______________________________________________
             addch                  curs_addch(3curses)
             addchnstr              curs_addchstr(3curses)
             addchstr               curs_addchstr(3curses)
             addnstr                curs_addstr(3curses)
             addnwstr               curs_addwstr(3curses)
             addstr                 curs_addstr(3curses)
             addwch                 curs_addwch(3curses)
             addwchnstr             curs_addwchstr(3curses)
             addwchstr              curs_addwchstr(3curses)
             addwstr                curs_addwstr(3curses)
             attroff                curs_attr(3curses)
             attron                 curs_attr(3curses)
             attrset                curs_attr(3curses)
             baudrate               curs_termattrs(3curses)
             beep                   curs_beep(3curses)
             bkgd                   curs_bkgd(3curses)
             bkgdset                curs_bkgd(3curses)
             border                 curs_border(3curses)
             box                    curs_border(3curses)
             can_change_color       curs_color(3curses)
             cbreak                 curs_inopts(3curses)
             clear                  curs_clear(3curses)
             clearok                curs_outopts(3curses)
             clrtobot               curs_clear(3curses)
             clrtoeol               curs_clear(3curses)
             color_content          curs_color(3curses)
             copywin                curs_overlay(3curses)
             curs_set               curs_kernel(3curses)
             def_prog_mode          curs_kernel(3curses)




                           Copyright 1994 Novell, Inc.               Page 5













      curses(3curses)                                      curses(3curses)


            curses Routine Name    Manual Page Name
            ______________________________________________
            def_shell_mode         curs_kernel(3curses)
            del_curterm            curs_terminfo(3curses)
            delay_output           curs_util(3curses)
            delch                  curs_delch(3curses)
            deleteln               curs_deleteln(3curses)
            delscreen              curs_initscr(3curses)
            delwin                 curs_window(3curses)
            derwin                 curs_window(3curses)
            doupdate               curs_refresh(3curses)
            draino                 curs_util(3curses)
            dupwin                 curs_window(3curses)
            echo                   curs_inopts(3curses)
            echochar               curs_addch(3curses)
            echowchar              curs_addwch(3curses)
            endwin                 curs_initscr(3curses)
            erase                  curs_clear(3curses)
            erasechar              curs_termattrs(3curses)
            filter                 curs_util(3curses)
            flash                  curs_beep(3curses)
            flushinp               curs_util(3curses)
            getbegyx               curs_getyx(3curses)
            getch                  curs_getch(3curses)
            getmaxyx               curs_getyx(3curses)
            getnwstr               curs_getwstr(3curses)
            getparyx               curs_getyx(3curses)
            getstr                 curs_getstr(3curses)
            getsyx                 curs_kernel(3curses)
            getwch                 curs_getwch(3curses)
            getwin                 curs_util(3curses)
            getwstr                curs_getwstr(3curses)
            getyx                  curs_getyx(3curses)
            halfdelay              curs_inopts(3curses)
            has_colors             curs_color(3curses)
            has_ic                 curs_termattrs(3curses)
            has_il                 curs_termattrs(3curses)
            hline                  curs_border(3curses)
            idcok                  curs_outopts(3curses)
            idlok                  curs_outopts(3curses)
            immedok                curs_outopts(3curses)
            inch                   curs_inch(3curses)
            inchnstr               curs_inchstr(3curses)
            inchstr                curs_inchstr(3curses)




                          Copyright 1994 Novell, Inc.               Page 6













       curses(3curses)                                      curses(3curses)


             curses Routine Name    Manual Page Name
             ______________________________________________
             init_color             curs_color(3curses)
             init_pair              curs_color(3curses)
             initscr                curs_initscr(3curses)
             innstr                 curs_instr(3curses)
             innwstr                curs_inwstr(3curses)
             insch                  curs_insch(3curses)
             insdelln               curs_deleteln(3curses)
             insertln               curs_deleteln(3curses)
             insnstr                curs_insstr(3curses)
             insnwstr               curs_inswstr(3curses)
             insstr                 curs_insstr(3curses)
             instr                  curs_instr(3curses)
             inswch                 curs_inswch(3curses)
             inswstr                curs_inswstr(3curses)
             intrflush              curs_inopts(3curses)
             inwch                  curs_inwch(3curses)
             inwchnstr              curs_inwchstr(3curses)
             inwchstr               curs_inwchstr(3curses)
             inwstr                 curs_inwstr(3curses)
             is_linetouched         curs_touch(3curses)
             is_wintouched          curs_touch(3curses)
             isendwin               curs_initscr(3curses)
             keyname                curs_util(3curses)
             keypad                 curs_inopts(3curses)
             killchar               curs_termattrs(3curses)
             leaveok                curs_outopts(3curses)
             longname               curs_termattrs(3curses)
             meta                   curs_inopts(3curses)
             move                   curs_move(3curses)
             mvaddch                curs_addch(3curses)
             mvaddchnstr            curs_addchstr(3curses)
             mvaddchstr             curs_addchstr(3curses)
             mvaddnstr              curs_addstr(3curses)
             mvaddnwstr             curs_addwstr(3curses)
             mvaddstr               curs_addstr(3curses)
             mvaddwch               curs_addwch(3curses)
             mvaddwchnstr           curs_addwchstr(3curses)
             mvaddwchstr            curs_addwchstr(3curses)
             mvaddwstr              curs_addwstr(3curses)
             mvcur                  curs_terminfo(3curses)
             mvdelch                curs_delch(3curses)
             mvderwin               curs_window(3curses)




                           Copyright 1994 Novell, Inc.               Page 7













      curses(3curses)                                      curses(3curses)


            curses Routine Name    Manual Page Name
            ______________________________________________
            mvgetch                curs_getch(3curses)
            mvgetnwstr             curs_getwstr(3curses)
            mvgetstr               curs_getstr(3curses)
            mvgetwch               curs_getwch(3curses)
            mvgetwstr              curs_getwstr(3curses)
            mvinch                 curs_inch(3curses)
            mvinchnstr             curs_inchstr(3curses)
            mvinchstr              curs_inchstr(3curses)
            mvinnstr               curs_instr(3curses)
            mvinnwstr              curs_inwstr(3curses)
            mvinsch                curs_insch(3curses)
            mvinsnstr              curs_insstr(3curses)
            mvinsnwstr             curs_inswstr(3curses)
            mvinsstr               curs_insstr(3curses)
            mvinstr                curs_instr(3curses)
            mvinswch               curs_inswch(3curses)
            mvinswstr              curs_inswstr(3curses)
            mvinwch                curs_inwch(3curses)
            mvinwchnstr            curs_inwchstr(3curses)
            mvinwchstr             curs_inwchstr(3curses)
            mvinwstr               curs_inwstr(3curses)
            mvprintw               curs_printw(3curses)
            mvscanw                curs_scanw(3curses)
            mvwaddch               curs_addch(3curses)
            mvwaddchnstr           curs_addchstr(3curses)
            mvwaddchstr            curs_addchstr(3curses)
            mvwaddnstr             curs_addstr(3curses)
            mvwaddnwstr            curs_addwstr(3curses)
            mvwaddstr              curs_addstr(3curses)
            mvwaddwch              curs_addwch(3curses)
            mvwaddwchnstr          curs_addwchstr(3curses)
            mvwaddwchstr           curs_addwchstr(3curses)
            mvwaddwstr             curs_addwstr(3curses)
            mvwdelch               curs_delch(3curses)
            mvwgetch               curs_getch(3curses)
            mvwgetnwstr            curs_getwstr(3curses)
            mvwgetstr              curs_getstr(3curses)
            mvwgetwch              curs_getwch(3curses)
            mvwgetwstr             curs_getwstr(3curses)
            mvwin                  curs_window(3curses)
            mvwinch                curs_inch(3curses)
            mvwinchnstr            curs_inchstr(3curses)




                          Copyright 1994 Novell, Inc.               Page 8













       curses(3curses)                                      curses(3curses)


             curses Routine Name    Manual Page Name
             ______________________________________________
             mvwinchstr             curs_inchstr(3curses)
             mvwinnstr              curs_instr(3curses)
             mvwinnwstr             curs_inwstr(3curses)
             mvwinsch               curs_insch(3curses)
             mvwinsnstr             curs_insstr(3curses)
             mvwinsstr              curs_insstr(3curses)
             mvwinstr               curs_instr(3curses)
             mvwinswch              curs_inswch(3curses)
             mvwinswstr             curs_inswstr(3curses)
             mvwinwch               curs_inwch(3curses)
             mvwinwchnstr           curs_inwchstr(3curses)
             mvwinwchstr            curs_inwchstr(3curses)
             mvwinwstr              curs_inwstr(3curses)
             mvwprintw              curs_printw(3curses)
             mvwscanw               curs_scanw(3curses)
             napms                  curs_kernel(3curses)
             newpad                 curs_pad(3curses)
             newterm                curs_initscr(3curses)
             newwin                 curs_window(3curses)
             nl                     curs_outopts(3curses)
             nocbreak               curs_inopts(3curses)
             nodelay                curs_inopts(3curses)
             noecho                 curs_inopts(3curses)
             nonl                   curs_outopts(3curses)
             noqiflush              curs_inopts(3curses)
             noraw                  curs_inopts(3curses)
             notimeout              curs_inopts(3curses)
             overlay                curs_overlay(3curses)
             overwrite              curs_overlay(3curses)
             pair_content           curs_color(3curses)
             pechochar              curs_pad(3curses)
             pechowchar             curs_pad(3curses)
             pnoutrefresh           curs_pad(3curses)
             prefresh               curs_pad(3curses)
             printw                 curs_printw(3curses)
             putp                   curs_terminfo(3curses)
             putwin                 curs_util(3curses)
             qiflush                curs_inopts(3curses)
             raw                    curs_inopts(3curses)
             redrawwin              curs_refresh(3curses)
             refresh                curs_refresh(3curses)
             reset_prog_mode        curs_kernel(3curses)




                           Copyright 1994 Novell, Inc.               Page 9













      curses(3curses)                                      curses(3curses)


            curses Routine Name    Manual Page Name
            ______________________________________________
            reset_shell_mode       curs_kernel(3curses)
            resetty                curs_kernel(3curses)
            restartterm            curs_terminfo(3curses)
            ripoffline             curs_kernel(3curses)
            savetty                curs_kernel(3curses)
            scanw                  curs_scanw(3curses)
            scr_dump               curs_scr_dump(3curses)
            scr_init               curs_scr_dump(3curses)
            scr_restore            curs_scr_dump(3curses)
            scr_set                curs_scr_dump(3curses)
            scrl                   curs_scroll(3curses)
            scroll                 curs_scroll(3curses)
            scrollok               curs_outopts(3curses)
            set_curterm            curs_terminfo(3curses)
            set_term               curs_initscr(3curses)
            setscrreg              curs_outopts(3curses)
            setsyx                 curs_kernel(3curses)
            setterm                curs_terminfo(3curses)
            setupterm              curs_terminfo(3curses)
            slk_attroff            curs_slk(3curses)
            slk_attron             curs_slk(3curses)
            slk_attrset            curs_slk(3curses)
            slk_clear              curs_slk(3curses)
            slk_init               curs_slk(3curses)
            slk_label              curs_slk(3curses)
            slk_noutrefresh        curs_slk(3curses)
            slk_refresh            curs_slk(3curses)
            slk_restore            curs_slk(3curses)
            slk_set                curs_slk(3curses)
            slk_touch              curs_slk(3curses)
            standend               curs_attr(3curses)
            standout               curs_attr(3curses)
            start_color            curs_color(3curses)
            subpad                 curs_pad(3curses)
            subwin                 curs_window(3curses)
            syncok                 curs_window(3curses)
            termattrs              curs_termattrs(3curses)
            termname               curs_termattrs(3curses)
            tgetent                curs_termcap(3curses)
            tgetflag               curs_termcap(3curses)
            tgetnum                curs_termcap(3curses)
            tgetstr                curs_termcap(3curses)




                          Copyright 1994 Novell, Inc.              Page 10













       curses(3curses)                                      curses(3curses)


             curses Routine Name    Manual Page Name
             ______________________________________________
             tgoto                  curs_termcap(3curses)
             tigetflag              curs_terminfo(3curses)
             tigetnum               curs_terminfo(3curses)
             tigetstr               curs_terminfo(3curses)
             timeout                curs_inopts(3curses)
             touchline              curs_touch(3curses)
             touchwin               curs_touch(3curses)
             tparm                  curs_terminfo(3curses)
             tputs                  curs_termcap(3curses)
             tputs                  curs_terminfo(3curses)
             typeahead              curs_inopts(3curses)
             unctrl                 curs_util(3curses)
             ungetch                curs_getch(3curses)
             ungetwch               curs_getwch(3curses)
             untouchwin             curs_touch(3curses)
             use_env                curs_util(3curses)
             vidattr                curs_terminfo(3curses)
             vidputs                curs_terminfo(3curses)
             vline                  curs_border(3curses)
             vwprintw               curs_printw(3curses)
             vwscanw                curs_scanw(3curses)
             waddch                 curs_addch(3curses)
             waddchnstr             curs_addchstr(3curses)
             waddchstr              curs_addchstr(3curses)
             waddnstr               curs_addstr(3curses)
             waddnwstr              curs_addwstr(3curses)
             waddstr                curs_addstr(3curses)
             waddwch                curs_addwch(3curses)
             waddwchnstr            curs_addwchstr(3curses)
             waddwchstr             curs_addwchstr(3curses)
             waddwstr               curs_addwstr(3curses)
             wattroff               curs_attr(3curses)
             wattron                curs_attr(3curses)
             wattrset               curs_attr(3curses)
             wbkgd                  curs_bkgd(3curses)
             wbkgdset               curs_bkgd(3curses)
             wborder                curs_border(3curses)
             wclear                 curs_clear(3curses)
             wclrtobot              curs_clear(3curses)
             wclrtoeol              curs_clear(3curses)
             wcursyncup             curs_window(3curses)
             wdelch                 curs_delch(3curses)




                           Copyright 1994 Novell, Inc.              Page 11













      curses(3curses)                                      curses(3curses)


            curses Routine Name    Manual Page Name
            ______________________________________________
            wdeleteln              curs_deleteln(3curses)
            wechochar              curs_addch(3curses)
            wechowchar             curs_addwch(3curses)
            werase                 curs_clear(3curses)
            wgetch                 curs_getch(3curses)
            wgetnstr               curs_getstr(3curses)
            wgetnwstr              curs_getwstr(3curses)
            wgetstr                curs_getstr(3curses)
            wgetwch                curs_getwch(3curses)
            wgetwstr               curs_getwstr(3curses)
            whline                 curs_border(3curses)
            winch                  curs_inch(3curses)
            winchnstr              curs_inchstr(3curses)
            winchstr               curs_inchstr(3curses)
            winnstr                curs_instr(3curses)
            winnwstr               curs_inwstr(3curses)
            winsch                 curs_insch(3curses)
            winsdelln              curs_deleteln(3curses)
            winsertln              curs_deleteln(3curses)
            winsnstr               curs_insstr(3curses)
            winsnwstr              curs_inswstr(3curses)
            winsstr                curs_insstr(3curses)
            winstr                 curs_instr(3curses)
            winswch                curs_inswch(3curses)
            winswstr               curs_inswstr(3curses)
            winwch                 curs_inwch(3curses)
            winwchnstr             curs_inwchstr(3curses)
            winwchstr              curs_inwchstr(3curses)
            winwstr                curs_inwstr(3curses)
            wmove                  curs_move(3curses)
            wnoutrefresh           curs_refresh(3curses)
            wprintw                curs_printw(3curses)
            wredrawln              curs_refresh(3curses)
            wrefresh               curs_refresh(3curses)
            wscanw                 curs_scanw(3curses)
            wscrl                  curs_scroll(3curses)
            wsetscrreg             curs_outopts(3curses)
            wstandend              curs_attr(3curses)
            wstandout              curs_attr(3curses)
            wsyncdown              curs_window(3curses)
            wsyncup                curs_window(3curses)
            wtimeout               curs_inopts(3curses)




                          Copyright 1994 Novell, Inc.              Page 12













       curses(3curses)                                      curses(3curses)


             curses Routine Name    Manual Page Name
             ______________________________________________
             wtouchln               curs_touch(3curses)
             wvline                 curs_border(3curses)

       RETURN VALUE
             Routines that return an integer return ERR upon failure and an
             integer value other than ERR upon successful completion,
             unless otherwise noted in the routine descriptions.

             All macros return the value of the window version, except
             setscrreg, wsetscrreg, getyx, getbegyx and getmaxyx.  The
             return values of setscrreg, wsetscrreg, getyx, getbegyx and
             getmaxyx are undefined (that is, these should not be used as
             the right-hand side of assignment statements).

             Routines that return pointers return NULL on error.

       NOTICES
             The header file curses.h automatically includes the header
             files stdio.h and unctrl.h.

       REFERENCES
             terminfo(4) and 3curses pages whose names begin ``curs_'' for
             detailed routine descriptions























                           Copyright 1994 Novell, Inc.              Page 13








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026