border, wborder, box, hline, whline, vline, wvline, mvhline, mvwhline, mvvline, mvwvline - draw borders
Contents
Description
wborder and border draw a box at the edges of the specified window or stdscr, respectively. Each chtype
argument corresponds to a geometric component of the border as follows:
ls - left side,
rs - right side,
ts - top side,
bs - bottom side,
tl - top left-hand corner,
tr - top right-hand corner,
bl - bottom left-hand corner, and
br - bottom right-hand corner.
If any chtype argument is 0, then curses uses forms-drawing characters (see addch(3NCURSES)) in the
following correspondence:
ACS_VLINE,
ACS_VLINE,
ACS_HLINE,
ACS_HLINE,
ACS_ULCORNER,
ACS_URCORNER,
ACS_LLCORNER, and
ACS_LRCORNER.
box(win,verch,horch) is shorthand for “wborder(win,verch,horch,0,0,0,0)”.
whline draws a horizontal line of ch from left to right, and wvline a vertical one from top to bottom,
stopping once n characters have been drawn or upon reaching the boundary of win. These functions do not
update the cursor position (beyond any motion directed by their “mv” variants). ncurses(3NCURSES)
describes the variants of these functions.
History
4BSD (1980) introduced box, defining it as a function.
SVr3.1 (1987) added whline and wvline and their variants, as well as border and wborder, redefining box
as a macro wrapping the latter.
Name
border, wborder, box, hline, whline, vline, wvline, mvhline, mvwhline, mvvline, mvwvline - draw borders
and lines in a curses window of characters
Notes
Unusually, there is no wbox function; box behaves as one would expect wbox to, accepting a WINDOW pointer
argument.
border, box, hline, mvhline, mvwhline, vline, mvvline, and mvwvline may be implemented as macros.
Borders drawn by these functions are interior borders.
Portability
These functions are described in X/Open Curses Issue 4. It specifies no error conditions for them.
SVr4 documentation says that these functions return OK “or a non-negative integer if immedok() is set”,
referring to the return value from wrefresh, which in SVr4 returns a count of characters written to the
window if its immedok property is set; in ncurses, it does not.
BSD curses drew boxes with horch in every character cell of the top and bottom lines of the window,
whereas SVr3.1 and later curses, because its box wrapped wborder, used the default corner characters.
Return Value
These functions return OK on success and ERR on failure.
In ncurses,
• these functions fail if the screen is not initialized; and
• functions taking a WINDOW pointer argument fail if win is a null pointer.
Functions prefixed with “mv” first perform cursor movement and fail if the position (y, x) is outside the
window boundaries.
See Also
ncurses(3NCURSES), outopts(3NCURSES) ncurses 6.5 2025-02-01 border(3NCURSES)
Synopsis
#include<curses.h>intborder(chtypels,chtypers,chtypets,chtypebs,chtypetl,chtypetr,chtypebl,chtypebr);intwborder(WINDOW*win,chtypels,chtypers,chtypets,chtypebs,chtypetl,chtypetr,chtypebl,chtypebr);intbox(WINDOW*win,chtypeverch,chtypehorch);inthline(chtypech,intn);intwhline(WINDOW*win,chtypech,intn);intmvhline(inty,intx,chtypech,intn);intmvwhline(WINDOW*win,inty,intx,chtypech,intn);intvline(chtypech,intn);intwvline(WINDOW*win,chtypech,intn);intmvvline(inty,intx,chtypech,intn);intmvwvline(WINDOW*win,inty,intx,chtypech,intn);
See Also
🪟
Window 