xref: /netbsd-src/lib/libcurses/curses_addstr.3 (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1.\"	$NetBSD: curses_addstr.3,v 1.7 2019/07/28 14:28:50 sevan Exp $
2.\"
3.\" Copyright (c) 2002
4.\"	Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
5.\"
6.\" This code is donated to the NetBSD Foundation by the Author.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. The name of the Author may not be used to endorse or promote
17.\"    products derived from this software without specific prior written
18.\"    permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"
33.Dd July 28, 2019
34.Dt CURSES_ADDSTR 3
35.Os
36.Sh NAME
37.Nm curses_addstr ,
38.Nm addstr ,
39.Nm addwstr ,
40.Nm waddstr ,
41.Nm waddwstr ,
42.Nm addnstr ,
43.Nm addnwstr ,
44.Nm waddnstr ,
45.Nm waddnwstr ,
46.Nm mvaddstr ,
47.Nm mvaddwstr ,
48.Nm mvwaddstr ,
49.Nm mvwaddwstr ,
50.Nm mvaddnstr ,
51.Nm mvaddnwstr ,
52.Nm mvwaddnstr ,
53.Nm mvwaddnwstr
54.Nd curses add character strings to windows routines
55.Sh LIBRARY
56.Lb libcurses
57.Sh SYNOPSIS
58.In curses.h
59.Ft int
60.Fn addstr "const char *string"
61.Ft int
62.Fn addwstr "const wchar_t *string"
63.Ft int
64.Fn waddstr "WINDOW *win" "const char *string"
65.Ft int
66.Fn waddwstr "WINDOW *win" "const wchar_t *string"
67.Ft int
68.Fn mvaddstr "int y" "int x" "const char *string"
69.Ft int
70.Fn mvaddwstr "int y" "int x" "const wchar_t *string"
71.Ft int
72.Fn mvwaddstr "WINDOW *win" "int y" "int x" "const char *string"
73.Ft int
74.Fn mvwaddwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len"
75.Ft int
76.Fn addnstr "const char *string" "int len"
77.Ft int
78.Fn addnwstr "const wchar_t *string" "int len"
79.Ft int
80.Fn waddnstr "WINDOW *win" "const char *string" "int len"
81.Ft int
82.Fn waddnwstr "WINDOW *win" "const wchar_t *string" "int len"
83.Ft int
84.Fn mvaddnstr "int y" "int x" "const char *string" "int len"
85.Ft int
86.Fn mvaddnwstr "int y" "int x" "const wchar_t *string" "int len"
87.Ft int
88.Fn mvwaddnstr "WINDOW *win" "int y" "int x" "const char *string" "int len"
89.Ft int
90.Fn mvwaddnwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len"
91.Sh DESCRIPTION
92These functions add character strings to
93.Dv stdscr
94or to the specified window.
95.Pp
96The
97.Fn addstr
98function
99will add the characters passed in
100.Fa string
101to
102.Dv stdscr
103starting at the current cursor position.
104Any background attributes currently set on
105.Dv stdscr
106will be applied to the added character.
107The
108.Fn waddstr
109function does the same as
110.Fn addstr
111but adds the string to the window specified by
112.Fn win .
113.Pp
114The
115.Fn addnstr
116function will add the contents of
117.Fa string
118to
119.Dv stdscr
120but will limit the number of characters added to be, at most,
121.Fa len .
122If
123.Fa len
124is \-1 then
125.Fa addnstr
126will add the number of characters contained in the null terminated string
127.Fa string .
128Any background attributes currently set on
129.Dv stdscr
130will be applied to the added character.
131The
132.Fn waddnstr
133function
134does the same as
135.Fa addnstr
136but adds the string to the window specified by
137.Fa win .
138.Pp
139The functions
140.Fn mvaddstr ,
141.Fn mwaddnstr ,
142.Fn mvwaddstr
143and
144.Fn mvwaddnstr
145are the same as the functions
146.Fn addstr ,
147.Fn waddstr ,
148.Fn waddstr
149and
150.Fn waddnstr ,
151respectively, excepting that
152.Fn wmove
153is called to move the cursor to the position specified by
154.Fa y ,
155.Fa x
156before the string is added to the window.
157.Sh RETURN VALUES
158Functions returning pointers will return
159.Dv NULL
160if an error is detected.
161The functions that return an int will return one of the following
162values:
163.Pp
164.Bl -tag -width ERR -compact
165.It Er OK
166The function completed successfully.
167.It Er ERR
168An error occurred in the function.
169.El
170.Sh SEE ALSO
171.Xr curses_addch 3 ,
172.Xr curses_addchstr 3 ,
173.Xr curses_attributes 3 ,
174.Xr curses_cursor 3 ,
175.Xr curses_inch 3
176.Sh STANDARDS
177The
178.Nx
179Curses library complies with the X/Open Curses specification, part of the
180Single Unix Specification.
181.Sh HISTORY
182The Curses package appeared in
183.Bx 4.0 .
184