curses - screen functions with ``optimal'' cursor motion
Curses Library (libcurses, -lcurses)
cc [flags] files -lcurses -ltermcap [libraries]
These routines give the user a method of updating screens with reasonable
optimization. They keep an image of the current screen, and the user
sets up an image of a new one. Then the refresh() tells the routines to
make the current screen look like the new one. In order to initialize
the routines, the routine initscr() must be called before any of the
other routines that deal with windows and screens are used. The routine
endwin() should be called before exiting. The routine start_color() must
be called before any of the other routines that deal with color are used.
ioctl(2), getenv(3), tty(4), termcap(5)
Ken Arnold, Screen Updating and Cursor Movement Optimization: A Library
Package.
Ken Arnold
addch(ch) add a character to stdscr
addstr(str) add a string to stdscr
addnstr(str,len) add no more than len chars of
string to stdscr
attron(attribute) turn on attribute modes
attroff(attribute) turn off attribute modes
attrset(attribute) set attribute modes
beep() sound the terminal bell
bkgd(ch) set background rendition for
stdscr and applies this rendition
to stdscr
bkgdset(ch) set background rendition for
stdscr
border(ls,rs,ts,bs,tl,tr,bl,br) draw a border around stdscr
box(win,vert,hor) draw a box around a window
can_change_colors() check if terminal can change
colors
cbreak() set cbreak mode
clear() clear stdscr
clearok(win,boolf) set clear flag for win
clrtobot() clear to bottom on stdscr
clrtoeol() clear to end of line on stdscr
color_content(c, r, g, b) get rgb values of color
copywin(srcwin, dstwin, sminrow, smincol, dminrow, dmincol, dmaxrow,
dmaxcol, overlay)
Copy rectangle from srcwin to
dstwin. If overlay is true
then copy is nondestructive.
curs_set(vis) change cursor visibility, 0 is
invisible, 1 is normal, 2 is
high visibility. Returns previous
value on success.
delay_output(ms) pause output for ms milliseconds
using terminal pad character.
def_prog_mode() define program (in curses)
terminal modes
def_shell_mode() define shell (not in curses)
terminal modes
delch() delete a character
deleteln() delete a line
delscreen(screen) free all associated storage and
destroy screen.
delwin(win) delete win
derwin(win,lines,cols,begin_y,begin_x) create a subwindow relative to
win.
doupdate() make current screen look like
virtual screen
dupwin(win) duplicate win
echo() set echo mode
endwin() end window modes
erase() erase stdscr
erasechar() Return the terminal erase
character
flash() flash the terminal screen
flushinp() flush terminal input
flushok(win,boolf) set flush-on-refresh flag for
win
fullname(termbuf,name) get full name from termbuf
getattrs(win) get attributes for win
getbkgd(win) get background rendition for
win
getcap(name) get terminal capability name
getch() get a char through stdscr
getcury(win) get current y position on win
getcurx(win) get current x position on win
getbegy(win) get start y position of win
getbegx(win) get start x position of win
getmaxy(win) get maximum y position on win
getmaxx(win) get maximum x position on win
getnstr(str, len) get a string of maximun len
characters through stdscr
getpary(win) get start y position of
subwindow win relative to parent.
getparx(win) get start x position of
subwindow win relative to parent.
getparyx(win, y, x) set y and x to position of
subwindow win relative to parent.
getstr(str) get a string through stdscr
gettmode() get tty modes
getyx(win,y,x) get (y,x) co-ordinates
has_colors() check if terminal has colors
has_ic() check if terminal has
insert/delete character
has_il() check if terminal has
insert/delete line
hline(ch, count) draw a horizontal line of
character ch.
idlok(win,boolf) set insert/deleteln flags for
win
inch() get char at current (y,x)
co-ordinates
inchnstr(chstr, n) get an array of characters from
stdscr
inchstr(chstr) get an array of characters from
stdscr
innstr(str, n) get a string of characters from
stdscr
init_color(c, r, g, b) set rgb values of color
init_pair(p, f, b) set foreground and background
colors of pair
initscr() initialize screens
insch(c) insert a char
insdelln(n) insert/delete n lines on stdstr
insertln() insert a line
instr(str) get a string of characters from
stdscr
intrflush(win,boolf) set flush on interrupt terminal
mode
is_linetouched(win, line) check if line has been modified
since last refresh.
is_wintouched(win) Check if window has been
modified since last refresh.
isendwin() check if endwin() or wrefresh()
was called latest
keypad(win,boolf) set keypad flag for win
killchar() Return the terminal kill
character.
leaveok(win,boolf) set leave flag for win
longname(termbuf,name) get long name from termbuf
meta(win,boolf) turn terminal meta mode on and
off. Note win is always
ignored.
move(y,x) move to (y,x) on stdscr
mvcur(lasty,lastx,newy,newx) actually move cursor
mvderwin(win, y, x) move window to (y,x) within
parent window.
mvgetnstr(str, len) move to y, x and get a string
of maximun n characters through
stdscr
mvgetstr(str, n) move to y, x and get a string
through stdscr
mvhline(y, x, ch, count) move to y, x and draw a horizontal
line of character ch for
count characters.
mvvline(y, x, ch, count) move to y, x and draw a vertical
line of character ch for
count characters.
mvwgetnstr(str, len) move to y, x and get a string
of maximun n characters through
win
mvwgetstr(str, n) move to y, x and get a string
through win
mvwhline(win, y, x, ch, count) move to y, x and draw a horizontal
line of character ch for
count characters on window win.
mvwvline(win, y, x, ch, count) move to y, x and draw a vertical
line of character ch for
count characters on window win.
napms(ms) sleep for ms milliseconds.
newterm(type, outfd, infd) Initialises the curses
subsystem for a multi-terminal
application. Type is the type
of terminal, if this is NULL
then $TERM is used. The infd
and outfd are the input and
output file streams.
newwin(lines,cols,begin_y,begin_x) create a new window
nl() set newline mapping
nocbreak() unset cbreak mode
nodelay(win,boolf) unset blocking reads for win
noecho() unset echo mode
nonl() unset newline mapping
noraw() unset raw mode
notimeout(win, boolf) unset infinite timeout on
keypad assembly for win
overlay(win1,win2) overlay win1 on win2
overwrite(win1,win2) overwrite win1 on top of win2
pair_content(p, r, g, b) get foreground and background
colors of pair
printw(fmt,arg1,arg2,...) printf on stdscr
raw() set raw mode
refresh() make current screen look like
stdscr
reset_prog_mode() restore program (in curses)
terminal modes
reset_shell_mode() restore shell (not in curses)
terminal modes
resetty() reset tty flags to stored value
resizeterm(lines,cols) resize the curses terminal,
application must redraw the
screen contents after this call
savetty() stored current tty flags
scanw(fmt,arg1,arg2,...) scanf through stdscr
scrl(n) scroll stdscr n lines
scroll(win) scroll win one line
scrollok(win,boolf) set scroll flag for win
setscrreg(top, bottom) set scrolling region on stdscr
set_term(screen) sets the curses screen to the
given one. Returns the previous
screen.
setterm(name) set term variables for name
standend() end standout mode
standout() start standout mode
start_color() initialise color
subwin(win,lines,cols,begin_y,begin_x) create a subwindow
timeout(delay) set blocking or non-blocking
read for stdscr
touchline(win,y,sx,ex) mark line y sx through sy as
changed
touchoverlap(win1,win2) mark overlap of win1 on win2 as
changed
touchwin(win) change all of win
unctrl(ch) printable version of ch
underend() end underscore mode
underscore() start underscore mode
ungetch(ch) Put character back onto input
queue.
untouchwin(win) Make window appear not to have
been modified.
vline(ch, count) Draw a vertical line of
character ch.
waddch(win,ch) add char to win
waddstr(win,str) add string to win
wattron(win,attribute) turn on attribute modes for win
wattroff(win,attribute) turn off attribute modes for
win
wattrset(win,attribute) set attribute modes for win
wbkgd(win, ch) set background rendition for
win and apply this rendition to
win
wbkgdset(win, ch) set background rendition for
win
wborder(win,ls,rs,ts,bs,tl,tr,bl,br) draw a border around win
wclear(win) clear win
wclrtobot(win) clear to bottom of win
wclrtoeol(win) clear to end of line on win
wdelch(win) delete char from win
wdeleteln(win) delete line from win
werase(win) erase win
wgetch(win) get a char through win
wgetnstr(win, str, len) get a string of maximun n
characters through win
wgetstr(win, str) get a string through win
whline(win, ch, count) Draw a horizontal line of
character ch on window win.
winch(win) get char at current (y,x) in
win
winchnstr(win, chstr, n) get an array of characters from
win
winchstr(win, chstr) get an array of characters from
win
winnstr(win, str, n) get a string of characters from
win
winsch(win,c) insert char into win
winsdelln(win,n) insert/delete n lines on win
winsertln(win) insert line into win
winstr(win,str) get a string of characters from
win
wmove(win,y,x) set current (y,x) co-ordinates
on win
wnoutrefresh(win) add win to virtual screen
wprintw(win,fmt,arg1,arg2,...) printf on win
wrefresh(win) make screen look like win
wresize(win,lines,cols) resize win
wscanw(win,fmt,arg1,arg2,...) scanf through win
wscrl(win,n) scroll win n lines
wsetscrreg(win, top, bottom) set scrolling region on win
wstandend(win) end standout mode on win
wstandout(win) start standout mode on win
wtimeout(win,delay) set blocking or non-blocking
read for win
wtouchln(win, line, n, changed) If changed is 1 then touch n
lines starting at line in window
win. If changed is 0 then
untouch n lines starting at
line in window win
wunderend(win) end underscore mode on win
wunderscore(win) start underscore mode on win
wvline(win, ch, count) Draw a vertical line of
character ch on window win.
The curses package appeared in 4.0BSD.
BSD March 11, 1999 BSD
[ Back ] |