DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

curs_kernel(S-osr5)


curs_kernel: def_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode, resetty, savetty, getsyx, setsyx, ripoffline, curs_set, napms -- low-level curses routines

Syntax

cc ... -lcurses

#include <curses.h>

int def_prog_mode(void); int def_shell_mode(void); int reset_prog_mode(void); int reset_shell_mode(void); int resetty(void); int savetty(void); int getsyx(int y, int x); int setsyx(int y, int x); int ripoffline(int line, int (*init)(WINDOW *, int)); int curs_set(int visibility); int napms(int ms);

Description

The following routines give low-level access to various curses(S-osr5) functionality. These routines typically are used inside library routines.

def_prog_mode and def_shell_mode

The def_prog_mode(S-osr5) and def_shell_mode(S-osr5) routines save the current terminal modes as the ``program'' (in curses( )) or ``shell'' (not in curses( )) state for use by the reset_prog_mode(S-osr5) and reset_shell_mode(S-osr5) routines. This is done automatically by initscr(S-osr5).

reset_prog_mode and reset_shell_mode

The reset_prog_mode( ) and reset_shell_mode( ) routines restore the terminal to ``program'' (in curses( )) or ``shell'' (out of curses( )) state. These are done automatically by endwin(S-osr5) and, after an endwin( ), by doupdate(S-osr5), so they normally are not called.

resetty and savetty

The resetty(S-osr5) and savetty(S-osr5) routines save and restore the state of the terminal modes. savetty( ) saves the current state in a buffer and resetty( ) restores the state to what it was at the last call to savetty( ).

getsyx and setsyx

With the getsyx(S-osr5) routine, the current coordinates of the virtual screen cursor are returned in y and x. If leaveok(S-osr5) is TRUE, then -1,-1 is returned. If lines have been removed from the top of the screen, using ripoffline(S-osr5), y and x include those lines; therefore, use y and x only as arguments for setsyx(S-osr5).

With the setsyx( ) routine, the virtual screen cursor is set to y, x. If y and x are both -1, then leaveok( ) is set. The two routines getsyx( ) and setsyx(S-osr5) are designed to be used by a library routine, which manipulates curses( ) windows but does not want to change the program's cursor position. The library routine calls getsyx( ) at the beginning, manipulates its own windows, does a wnoutrefresh(S-osr5) on its windows, calls setsyx( ), and then calls doupdate( ).

ripoffline

The ripoffline(S-osr5) routine provides access to the same facility that slk_init(S-osr5) (see curs_slk(S-osr5)) uses to reduce the size of the screen. ripoffline( ) must be called before initscr( ) or newterm(S-osr5) is called. If line is positive, a line is removed from the top of stdscr; if line is negative, a line is removed from the bottom.

When this is done inside initscr( ), the routine init (supplied by the user) is called with two arguments: a window pointer to the one-line window that has been allocated and an integer with the number of columns in the window. Inside this initialization routine, the integer variables LINES and COLS (defined in curses.h) are not guaranteed to be accurate and wrefresh(S-osr5) or doupdate( ) must not be called. It is allowable to call wnoutrefresh( ) during the initialization routine.

ripoffline( ) can be called up to five times before calling initscr( ) or newterm( ).

curs_set

With the curs_set(S-osr5) routine, the cursor state is set to invisible, normal, or very visible for visibility equal to 0, 1, or 2 respectively. If the terminal supports the visibility requested, the previous cursor state is returned; otherwise, ERR is returned.

napms

The napms(S-osr5) routine is used to sleep for ms milliseconds.

Return values

Except for curs_set( ), these routines always return OK. curs_set( ) returns the previous cursor state, or ERR if the requested visibility is not supported.

Warning

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

getsyx( ) is a macro, so & is not needed before the variables y and x.

Files


/usr/lib/libcurses.a
the library

See also

curses(S-osr5), curs_initscr(S-osr5), curs_outopts(S-osr5), curs_refresh(S-osr5), curs_scr_dump(S-osr5), curs_slk(S-osr5)

Standards conformance

def_prog_mode(S-osr5), def_shell_mode(S-osr5), reset_prog_mode(S-osr5), reset_shell_mode(S-osr5), resetty(S-osr5), savetty(S-osr5), getsyx(S-osr5), setsyx(S-osr5), ripoffline(S-osr5), curs_set(S-osr5), and napms(S-osr5) are not part of any currently supported standard; they were developed by UNIX System Laboratories, Inc. and are maintained by The SCO Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005