border(3NCURSES)
π border(3NCURSES) β Library calls π
okay bestie, welcome to the border(3NCURSES) page, it's giving frames, lines, and main character window energy β¨ this is the ncurses manual, and we're about to draw some boxes together π
β¨ NAME β¨
border, wborder, box, hline, whline, vline, wvline, mvhline, mvwhline, mvvline, mvwvline β draw borders and lines in a curses window of characters π
like⦠literally the girls that make your little terminal rectangle have an outline. iconic.
πΈ SYNOPSIS πΈ
#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 mvhline(int y, int x, chtype ch, int n);
int mvwhline(WINDOW *win, int y, int x, chtype ch, int n);
int vline(chtype ch, int n);
int wvline(WINDOW *win, 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);
π¦ DESCRIPTION π¦
so wborder and border draw a box at the edges of the specified window, or stdscr respectively π like one does the window you hand it, the other just does stdscr because it's confident like that.
every chtype argument maps to one lil geometric component of the border, and the assignment is:
lsβ left sidersβ right sidetsβ top sidebsβ bottom sidetlβ top left-hand cornertrβ top right-hand cornerblβ bottom left-hand cornerbrβ bottom right-hand corner
if any chtype argument is 0, then curses uses forms-drawing characters instead β see addch(3NCURSES) β and the correspondence goes like this, in order:
ACS_VLINEACS_VLINEACS_HLINEACS_HLINEACS_ULCORNERACS_URCORNERACS_LLCORNERACS_LRCORNER
like, it's giving default pretty lines when you can't be bothered to pick. no cap π«Ά
box(win, verch, horch) is shorthand for "wborder(win, verch, verch, horch, horch, 0, 0, 0, 0)". that's it, that's the whole function, she's a shortcut queen π
whline draws a horizontal line of ch from left to right, and wvline draws a vertical one from top to bottom β stopping once n characters have been drawn, or upon reaching the boundary of win. whichever comes first, bestie, she knows when to stop π
these functions do not update the cursor position β beyond any motion directed by their mv variants, of course. ncurses(3NCURSES) describes the variants of these functions. iykyk β¨
π RETURN VALUE π
these functions return OK on success and ERR on failure. periodt.
in ncurses, specifically:
- these functions fail if the screen is not initialized; and
- functions taking a
WINDOWpointer argument fail ifwinis a null pointer.
functions prefixed with mv first perform cursor movement, and they fail if the position (y, x) is outside the window boundaries. so like, don't go out of bounds, she will notice π
π NOTES π
unusually, there is no wbox function. no wbox, bestie, she simply doesn't exist. box behaves as one would expect wbox to, accepting a WINDOW pointer argument. so she ate and left no crumbs π
border, box, hline, mvhline, mvwhline, vline, mvvline, and mvwvline may be implemented as macros. sneaky! β
borders drawn by these functions are interior borders. they live inside, like a cozy little fairy π§
π PORTABILITY π
these functions are described in X/Open Curses Issue 4. it specifies no error conditions for them. none. zero. nothing. the audacity π
SVr4 documentation says these functions return OK "or a non-negative integer if immedok() is set" β that's 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. so don't go expecting that, fr fr.
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. glow-up, honestly πΈ
π HISTORY π
4BSD (1980) introduced box, defining it as a function. yes, a whole function, she was born that way.
SVr3.1 (1987) added whline and wvline and their variants, as well as border and wborder, and redefined box as a macro wrapping the latter. evolution, we love to see it π₯
π«Ά SEE ALSO π«Ά
ncurses(3NCURSES)outopts(3NCURSES)
and that's the whole page, bestie π this was ncurses 6.6, dated 2025-10-20, and it's called border(3NCURSES) β go draw ur lil boxes, you're gonna slay πβ¨π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2007,2010 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms