curs_kernel(S)
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)
functionality.
These routines typically are used inside library routines.
def_prog_mode and def_shell_mode
The
def_prog_mode(S)
and
def_shell_mode(S)
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)
and
reset_shell_mode(S)
routines.
This is done automatically by
initscr(S).
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)
and, after an
endwin( ),
by
doupdate(S),
so they normally are not called.
resetty and savetty
The
resetty(S)
and
savetty(S)
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)
routine,
the current coordinates of the virtual screen cursor are returned in
y and x.
If
leaveok(S)
is TRUE, then
-1,-1 is returned.
If lines have been removed from the top of the screen, using
ripoffline(S),
y and x include those lines;
therefore, use y and x only as arguments for
setsyx(S).
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)
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)
on its windows, calls
setsyx( ),
and then calls
doupdate( ).
ripoffline
The
ripoffline(S)
routine provides access to the same facility that
slk_init(S)
(see
curs_slk(S))
uses to reduce the size of the screen.
ripoffline( )
must be called before
initscr( )
or
newterm(S)
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)
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)
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)
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),
curs_initscr(S),
curs_outopts(S),
curs_refresh(S),
curs_scr_dump(S),
curs_slk(S)
Standards conformance
def_prog_mode(S),
def_shell_mode(S),
reset_prog_mode(S),
reset_shell_mode(S),
resetty(S),
savetty(S),
getsyx(S),
setsyx(S),
ripoffline(S),
curs_set(S),
and
napms(S)
are not part of any
currently supported standard;
they were developed by UNIX System Laboratories, Inc. and
are maintained by The SCO Group.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003