1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
.\"***************************************************************************
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
.\" "Software"), to deal in the Software without restriction, including *
.\" without limitation the rights to use, copy, modify, merge, publish, *
.\" distribute, distribute with modifications, sublicense, and/or sell *
.\" copies of the Software, and to permit persons to whom the Software is *
.\" furnished to do so, subject to the following conditions: *
.\" *
.\" The above copyright notice and this permission notice shall be included *
.\" in all copies or substantial portions of the Software. *
.\" *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
.\" *
.\" Except as contained in this notice, the name(s) of the above copyright *
.\" holders shall not be used in advertising or otherwise to promote the *
.\" sale, use or other dealings in this Software without prior written *
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_border.3x,v 1.65 2025/10/20 23:42:24 tom Exp $
.TH curs_border 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fB\%border\fP,
\fB\%wborder\fP,
\fB\%box\fP,
\fB\%hline\fP,
\fB\%whline\fP,
\fB\%vline\fP,
\fB\%wvline\fP,
\fB\%mvhline\fP,
\fB\%mvwhline\fP,
\fB\%mvvline\fP,
\fB\%mvwvline\fP \-
draw borders and lines in a \fIcurses\fR window of characters
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint border(chtype \fIls\fP, chtype \fIrs\fP, chtype \fIts\fP, chtype \fIbs\fP,
\fBchtype \fItl\fB, chtype \fItr\fB, chtype \fIbl\fB, chtype \fIbr\fB);\fR
\fBint wborder(WINDOW *\fIwin\fB, chtype \fIls\fB, chtype \fIrs\fB,\fR
\fBchtype \fIts\fB, chtype \fIbs\fB, chtype \fItl\fB, chtype \fItr\fB,\fR
\fBchtype \fIbl\fB, chtype \fIbr\fB);\fR
.PP
\fBint box(WINDOW *\fIwin\fB, chtype \fIverch\fB, chtype \fIhorch\fB);\fR
.PP
\fBint hline(chtype \fIch\fB, int \fIn\fB);\fR
\fBint whline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvhline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvwhline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
.PP
\fBint vline(chtype \fIch\fB, int \fIn\fB);\fR
\fBint wvline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvvline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvwvline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
.fi
.SH DESCRIPTION
.B \%wborder
and
.B \%border
draw a box at the edges of the specified window or
.BR \%stdscr ","
respectively.
Each
.I \%chtype
argument corresponds to a geometric component of the border as follows:
.RS
.I ls
\- left side,
.br
.I rs
\- right side,
.br
.I ts
\- top side,
.br
.I bs
\- bottom side,
.br
.I tl
\- top left-hand corner,
.br
.I tr
\- top right-hand corner,
.br
.I bl
\- bottom left-hand corner, and
.br
.I br
\- bottom right-hand corner.
.RE
.PP
If any
.I \%chtype
argument is
.BR 0 ","
then
.I curses
uses forms-drawing characters
(see \fBaddch\fP(3X))
in the following correspondence:
.RS
.BR \%ACS_VLINE ","
.br
.BR \%ACS_VLINE ","
.br
.BR \%ACS_HLINE ","
.br
.BR \%ACS_HLINE ","
.br
.BR \%ACS_ULCORNER ","
.br
.BR \%ACS_URCORNER ","
.br
.BR \%ACS_LLCORNER ","
and
.br
.BR \%ACS_LRCORNER "."
.RE
.PP
.BI \%box( win ","
.IB verch ,
.IB horch )
is shorthand for
.RB \%\*(`` wborder(\c
.IB win ,
.IB verch ,
.IB verch ,
.IB horch ,
.IB horch ,
.BR "0, 0, 0, 0)" "\*(''."
.PP
.B \%whline
draws a horizontal line of
.I ch
from left to right,
and
.B \%wvline
a vertical one from top to bottom,
stopping once
.I n
characters have been drawn or upon reaching the boundary of
.IR win "."
These functions do not update the cursor position
(beyond any motion directed by their \*(``mv\*('' variants).
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
In
.IR \%ncurses ","
.bP
these functions fail if the screen is not initialized;
and
.bP
functions taking a
.I \%WINDOW
pointer argument fail if
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
.RI ( y ,
.IR x )
is outside the window boundaries.
.SH NOTES
Unusually,
there is no
.B \%wbox
function;
.B \%box
behaves as one would expect
.B \%wbox
to,
accepting a
.I \%WINDOW
pointer argument.
.PP
.BR \%border ","
.BR \%box ","
.BR \%hline ","
.BR \%mvhline ","
.BR \%mvwhline ","
.BR \%vline ","
.BR \%mvvline ","
and
.B \%mvwvline
may be implemented as macros.
.PP
Borders drawn by these functions are
.I interior
borders.
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/libcurses/box.c
.SH PORTABILITY
These functions are described in X/Open Curses Issue\ 4.
It specifies no error conditions for them.
.PP
SVr4 documentation
.\" SVID 4, vol. 3, p. 483
says that these functions return
.I OK
\*(``or a non-negative integer if
.I \%immedok() \" Courier roman in source
is set\*('',
referring to the return value from
.IR \%wrefresh ","
which in SVr4 returns a count of characters
written to the window if its
.I \%immedok
property is set;
.\" ...though its wrefresh() man page says nothing about immedok()...
in
.IR \%ncurses ","
it does not.
.PP
BSD
.I curses
drew boxes with
.I horch
in
.I every
character cell of the top and bottom lines of the window,
whereas SVr3.1 and later
.IR curses ","
because its
.I box
wrapped
.IR wborder ","
used the default corner characters.
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr3/31/\
.\" usr/src/lib/libcurses/screen/curses.ed#L454
.SH HISTORY
4BSD (1980)
introduced
.IR box ","
defining it as a function.
.PP
SVr3.1 (1987)
added
.I \%whline
and
.I \%wvline
and their variants,
as well as
.I \%border
and
.IR \%wborder ","
redefining
.I \%box
as a macro wrapping the latter.
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_outopts\fP(3X)
|