blob: 25d322aff0be48eed09699dca2a7b56bc3e6125c [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2019-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2012,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: curs_addchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $
31.TH curs_addchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "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.
Steve Kondikae271bc2015-11-15 02:50:53 +010043.de bP
micky3879b9f5e72025-07-08 18:04:53 -040044.ie n .IP \(bu 4
45.el .IP \(bu 2
Steve Kondikae271bc2015-11-15 02:50:53 +010046..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053047.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040048\fB\%addchstr\fP,
49\fB\%addchnstr\fP,
50\fB\%waddchstr\fP,
51\fB\%waddchnstr\fP,
52\fB\%mvaddchstr\fP,
53\fB\%mvaddchnstr\fP,
54\fB\%mvwaddchstr\fP,
55\fB\%mvwaddchnstr\fP \-
56add a \fIcurses\fR character string to a window
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057.SH SYNOPSIS
Steve Kondikae271bc2015-11-15 02:50:53 +010058.nf
micky3879b9f5e72025-07-08 18:04:53 -040059\fB#include <curses.h>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060.PP
micky3879b9f5e72025-07-08 18:04:53 -040061\fBint addchstr(const chtype *\fIchstr\fP);
62\fBint waddchstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP);
63\fBint mvaddchstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP);
64\fBint mvwaddchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP);
65.PP
66\fBint addchnstr(const chtype *\fIchstr\fP, int \fIn\fP);
67\fBint waddchnstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP, int \fIn\fP);
68\fBint mvaddchnstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP);
69\fBint mvwaddchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP);
Steve Kondikae271bc2015-11-15 02:50:53 +010070.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071.SH DESCRIPTION
Steve Kondikae271bc2015-11-15 02:50:53 +010072These functions copy the (null-terminated)
micky3879b9f5e72025-07-08 18:04:53 -040073\fIchstr\fP array
Steve Kondikae271bc2015-11-15 02:50:53 +010074into the window image structure
75starting at the current cursor position.
micky3879b9f5e72025-07-08 18:04:53 -040076.PP
77The four functions with \fIn\fP as the last
78argument copy at most \fIn\fP elements,
Steve Kondikae271bc2015-11-15 02:50:53 +010079but no more than will fit on the line.
micky3879b9f5e72025-07-08 18:04:53 -040080If \fBn\fP=\fB\-1\fP then the whole array is copied,
Steve Kondikae271bc2015-11-15 02:50:53 +010081to the maximum number of characters that will fit on the line.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053082.PP
micky3879b9f5e72025-07-08 18:04:53 -040083The window cursor is \fInot\fP advanced.
84These functions are faster than \fBwaddnstr\fP.
Steve Kondikae271bc2015-11-15 02:50:53 +010085On the other hand:
86.bP
87they do not perform checking
88(such as for the newline, backspace, or carriage return characters),
89.bP
90they do not advance the current cursor position,
91.bP
92they do not expand other control characters to ^-escapes, and
93.bP
94they truncate the string if it crosses the right margin,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053095rather than wrapping it around to the new line.
Steve Kondikae271bc2015-11-15 02:50:53 +010096.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040097All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098.PP
micky3879b9f5e72025-07-08 18:04:53 -040099X/Open Curses does not specify any error conditions.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530100This implementation returns an error
micky3879b9f5e72025-07-08 18:04:53 -0400101.bP
102if the \fIwin\fP parameter is null or
103.bP
104if the \fIwchstr\fP parameter is null.
Steve Kondikae271bc2015-11-15 02:50:53 +0100105.PP
micky3879b9f5e72025-07-08 18:04:53 -0400106Functions prefixed with \*(``mv\*('' first perform cursor movement and
107fail if the position
108.RI ( y ,
109.IR x )
110is outside the window boundaries.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530111.SH NOTES
micky3879b9f5e72025-07-08 18:04:53 -0400112All functions except \fBwaddchnstr\fP may be macros.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530113.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400114These functions are described in X/Open Curses, Issue 4.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530115.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400116\fB\%curs_add_wchstr\fP(3X) describes comparable functions of the
117.I \%ncurses
118library in its wide-character configuration
119.RI ( \%ncursesw ).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530120.PP
micky3879b9f5e72025-07-08 18:04:53 -0400121\fB\%curses\fP(3X),
122\fB\%curs_addch\fP(3X),
123\fB\%curs_addstr\fP(3X)