DOKK / manpages / debian 11 / ncurses-doc / box.3ncurses.en
border(3NCURSES) border(3NCURSES)

border, wborder, box, hline, whline, vline, wvline, mvhline, mvwhline, mvvline, mvwvline - create curses borders, horizontal and vertical lines

#include <curses.h>

int border(chtype ls, chtype rs, chtype ts, chtype bs,
chtype tl, chtype tr, chtype bl, chtype br);
int wborder(WINDOW *win, chtype ls, chtype rs,
chtype ts, chtype bs, chtype tl, chtype tr,
chtype bl, chtype br);

int box(WINDOW *win, chtype verch, chtype horch);

int hline(chtype ch, int n);
int whline(WINDOW *win, chtype ch, int n);
int vline(chtype ch, int n);
int wvline(WINDOW *win, chtype ch, int n);

int mvhline(int y, int x, chtype ch, int n);
int mvwhline(WINDOW *win, int y, int x, chtype ch, int n);
int mvvline(int y, int x, chtype ch, int n);
int mvwvline(WINDOW *win, int y, int x, chtype ch, int n);

The border, wborder and box routines draw a box around the edges of a window. Other than the window, each argument is a character with attributes:

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 of these arguments is zero, then the corresponding default values (defined in curses.h) are used instead:

ACS_VLINE,
ACS_VLINE,
ACS_HLINE,
ACS_HLINE,
ACS_ULCORNER,
ACS_URCORNER,
ACS_LLCORNER,
ACS_LRCORNER.

box(win, verch, horch) is a shorthand for the following call: wborder(win, verch, verch, horch, horch, 0, 0, 0, 0).

The hline and whline functions draw a horizontal (left to right) line using ch starting at the current cursor position in the window. The current cursor position is not changed. The line is at most n characters long, or as many as fit into the window.

The vline and wvline functions draw a vertical (top to bottom) line using ch starting at the current cursor position in the window. The current cursor position is not changed. The line is at most n characters long, or as many as fit into the window.

All routines return the integer OK. The SVr4.0 manual says "or a non-negative integer if immedok is set", but this appears to be an error.

X/Open does not define any error conditions. This implementation returns an error if the window pointer is null.

Functions with a “mv” prefix first perform a cursor movement using wmove, and return an error if the position is outside the window, or if the window pointer is null.

The borders generated by these functions are inside borders (this is also true of SVr4 curses, though the fact is not documented).

Note that border and box may be macros.

These functions are described in the XSI Curses standard, Issue 4. The standard specifies that they return ERR on failure, but specifies no error conditions.

ncurses(3NCURSES), outopts(3NCURSES).