| 1 |
.\"*************************************************************************** |
| 2 |
.\" Copyright 2019-2024,2025 Thomas E. Dickey * |
| 3 |
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * |
| 4 |
.\" * |
| 5 |
.\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 |
.\" copy of this software and associated documentation files (the * |
| 7 |
.\" "Software"), to deal in the Software without restriction, including * |
| 8 |
.\" without limitation the rights to use, copy, modify, merge, publish, * |
| 9 |
.\" distribute, distribute with modifications, sublicense, and/or sell * |
| 10 |
.\" copies of the Software, and to permit persons to whom the Software is * |
| 11 |
.\" furnished to do so, subject to the following conditions: * |
| 12 |
.\" * |
| 13 |
.\" The above copyright notice and this permission notice shall be included * |
| 14 |
.\" in all copies or substantial portions of the Software. * |
| 15 |
.\" * |
| 16 |
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 |
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 |
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 |
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 |
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 |
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 |
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 |
.\" * |
| 24 |
.\" Except as contained in this notice, the name(s) of the above copyright * |
| 25 |
.\" holders shall not be used in advertising or otherwise to promote the * |
| 26 |
.\" sale, use or other dealings in this Software without prior written * |
| 27 |
.\" authorization. * |
| 28 |
.\"*************************************************************************** |
| 29 |
.\" |
| 30 |
.\" $Id: curs_add_wchstr.3x,v 1.61 2025/10/21 00:06:34 tom Exp $ |
| 31 |
.TH add_wchstr 3NCURSES 2025-10-20 "ncurses 6.6" "Library calls" |
| 32 |
.ie \n(.g \{\ |
| 33 |
.ds `` \(lq |
| 34 |
.ds '' \(rq |
| 35 |
.\} |
| 36 |
.el \{\ |
| 37 |
.ie t .ds `` `` |
| 38 |
.el .ds `` "" |
| 39 |
.ie t .ds '' '' |
| 40 |
.el .ds '' "" |
| 41 |
.\} |
| 42 |
. |
| 43 |
.de bP |
| 44 |
.ie n .IP \(bu 4 |
| 45 |
.el .IP \(bu 2 |
| 46 |
.. |
| 47 |
.SH NAME |
| 48 |
\fB\%add_wchstr\fP, |
| 49 |
\fB\%wadd_wchstr\fP, |
| 50 |
\fB\%mvadd_wchstr\fP, |
| 51 |
\fB\%mvwadd_wchstr\fP, |
| 52 |
\fB\%add_wchnstr\fP, |
| 53 |
\fB\%wadd_wchnstr\fP, |
| 54 |
\fB\%mvadd_wchnstr\fP, |
| 55 |
\fB\%mvwadd_wchnstr\fP \- |
| 56 |
add a \fIcurses\fR complex character string to a window |
| 57 |
.SH SYNOPSIS |
| 58 |
.nf |
| 59 |
\fB#include <curses.h> |
| 60 |
.PP |
| 61 |
\fBint add_wchstr(const cchar_t * \fIwchstr\fP); |
| 62 |
\fBint wadd_wchstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP); |
| 63 |
\fBint mvadd_wchstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP); |
| 64 |
\fBint mvwadd_wchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP); |
| 65 |
.PP |
| 66 |
\fBint add_wchnstr(const cchar_t * \fIwchstr\fP, int \fIn\fP); |
| 67 |
\fBint wadd_wchnstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP); |
| 68 |
\fBint mvadd_wchnstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP); |
| 69 |
\fBint mvwadd_wchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, |
| 70 |
const cchar_t * \fIwchstr\fP, int \fIn\fP); |
| 71 |
.fi |
| 72 |
.SH DESCRIPTION |
| 73 |
.B \%wadd_wchstr |
| 74 |
copies the string of complex characters |
| 75 |
.I \%wchstr |
| 76 |
to the window |
| 77 |
.IR win "." |
| 78 |
A null complex character terminates the string. |
| 79 |
If a complex character does not completely fit at the end of the line, |
| 80 |
.I curses |
| 81 |
fills its remaining cells with the window's background character; |
| 82 |
see \fB\%bkgrnd\fP(3NCURSES). |
| 83 |
.B \%wadd_wchnstr |
| 84 |
does the same, |
| 85 |
but copies at most |
| 86 |
.I n |
| 87 |
characters, |
| 88 |
or as many as possible if |
| 89 |
.I n |
| 90 |
is |
| 91 |
.BR \-1 "." |
| 92 |
\fB\%ncurses\fP(3NCURSES) describes the variants of these functions. |
| 93 |
.PP |
| 94 |
Because these functions do not call \fB\%wadd_wch\fP(3NCURSES) internally, |
| 95 |
they are faster than \fB\%waddwstr\fP(3NCURSES) and \fB\%waddnwstr\fP(3NCURSES). |
| 96 |
On the other hand, |
| 97 |
they |
| 98 |
.bP |
| 99 |
do not treat the backspace, |
| 100 |
carriage return, |
| 101 |
or line feed characters specially; |
| 102 |
.bP |
| 103 |
do not represent unprintable characters with \fB\%wunctrl\fP(3NCURSES); |
| 104 |
.bP |
| 105 |
do not update the cursor position to follow the last character written; |
| 106 |
and |
| 107 |
.bP |
| 108 |
truncate the string at the window's right margin, |
| 109 |
rather than wrapping it to the next line and potentially scrolling. |
| 110 |
.SH RETURN VALUE |
| 111 |
These functions return |
| 112 |
.B OK |
| 113 |
on success and |
| 114 |
.B ERR |
| 115 |
on failure. |
| 116 |
.PP |
| 117 |
In |
| 118 |
.IR \%ncurses "," |
| 119 |
these functions fail if |
| 120 |
.bP |
| 121 |
the |
| 122 |
.I curses |
| 123 |
screen has not been initialized, |
| 124 |
.bP |
| 125 |
.I wchstr |
| 126 |
is a null pointer, |
| 127 |
or |
| 128 |
.bP |
| 129 |
(for functions taking a |
| 130 |
.I \%WINDOW |
| 131 |
pointer argument) |
| 132 |
.I win |
| 133 |
is a null pointer. |
| 134 |
.PP |
| 135 |
Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 136 |
fail if the position |
| 137 |
.RI ( y , |
| 138 |
.IR x ) |
| 139 |
is outside the window boundaries. |
| 140 |
.SH NOTES |
| 141 |
All of these functions except |
| 142 |
.B \%wadd_wchnstr |
| 143 |
may be implemented as macros. |
| 144 |
.SH PORTABILITY |
| 145 |
X/Open Curses Issue\ 4 describes these functions. |
| 146 |
It specifies no error conditions for them. |
| 147 |
.SH HISTORY |
| 148 |
X/Open Curses Issue\ 4 (1995) initially specified these functions. |
| 149 |
The System\ V Interface Definition Version\ 4 |
| 150 |
of the same year |
| 151 |
specified functions named |
| 152 |
.I \%waddwchstr |
| 153 |
and |
| 154 |
.I \%waddwchnstr |
| 155 |
(and the usual variants). |
| 156 |
.\" SVID 4, vol 3., p. 477 |
| 157 |
These were later additions to |
| 158 |
.RI SVr4. x , |
| 159 |
not appearing in the first SVr4 (1989). |
| 160 |
They differed from X/Open's later |
| 161 |
.I \%wadd_wchstr |
| 162 |
and |
| 163 |
.I \%wadd_wchnstr |
| 164 |
in that they each took an argument of type |
| 165 |
.I \%wchar_t |
| 166 |
instead of |
| 167 |
.IR \%cchar_t "." |
| 168 |
.SH SEE ALSO |
| 169 |
\fB\%addchstr\fP(3NCURSES) describes comparable functions of the |
| 170 |
.I \%ncurses |
| 171 |
library in its non-wide-character configuration. |
| 172 |
.PP |
| 173 |
\fB\%ncurses\fP(3NCURSES), |
| 174 |
\fB\%addwstr\fP(3NCURSES), |
| 175 |
\fB\%add_wch\fP(3NCURSES) |