Debian Codegraph @

doc/html/man/curs_insstr.3x.html

raw
1 <!--
2 ****************************************************************************
3 * Copyright 2019-2024,2025 Thomas E. Dickey *
4 * Copyright 1998-2010,2017 Free Software Foundation, Inc. *
5 * *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
13 * *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
16 * *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
28 * authorization. *
29 ****************************************************************************
30 * @Id: curs_insstr.3x,v 1.72 2025/10/21 00:11:17 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_insstr 3x 2025-10-20 ncurses 6.6 Library calls</TITLE>
38 <link rel="author" href="mailto:[email protected]">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_insstr 3x 2025-10-20 ncurses 6.6 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG> Library calls <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG>
45
46
47 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
48 <STRONG>insstr</STRONG>, <STRONG>winsstr</STRONG>, <STRONG>mvinsstr</STRONG>, <STRONG>mvinsnstr</STRONG>, <STRONG>insnstr</STRONG>, <STRONG>winsnstr</STRONG>, <STRONG>mvwinsstr</STRONG>,
49 <STRONG>mvwinsnstr</STRONG> - insert a string in a <EM>curses</EM> window
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53 <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
54
55 <STRONG>int</STRONG> <STRONG>insstr(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>);</STRONG>
56 <STRONG>int</STRONG> <STRONG>winsstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>);</STRONG>
57 <STRONG>int</STRONG> <STRONG>mvinsstr(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>);</STRONG>
58 <STRONG>int</STRONG> <STRONG>mvwinsstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>);</STRONG>
59
60 <STRONG>int</STRONG> <STRONG>insnstr(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
61 <STRONG>int</STRONG> <STRONG>winsnstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
62 <STRONG>int</STRONG> <STRONG>mvinsnstr(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
63 <STRONG>int</STRONG> <STRONG>mvwinsnstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG> <EM>str</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
64
65
66 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
67 <STRONG>winsstr</STRONG> inserts a string <EM>str</EM> before the character at the cursor in
68 window <EM>win</EM> as if by calling <STRONG><A HREF="curs_insch.3x.html">winsch(3x)</A></STRONG> for each <EM>char</EM> in <EM>str</EM>. No line
69 wrapping is performed. Characters to the right of the cursor are
70 shifted right; those at the right edge of the window may be lost.
71 <STRONG>winsstr</STRONG> stops inserting if it would have to wrap to the next line to
72 write the next <EM>char</EM> in <EM>str</EM>. The cursor position does not change (after
73 moving to (<EM>y</EM>, <EM>x</EM>), if specified). <STRONG>insnstr</STRONG> does the same, but inserts at
74 most <EM>n</EM> characters, or as many as possible (up to the end of the line)
75 if <EM>n</EM> is negative. <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> describes the variants of these
76 functions.
77
78
79 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
80 These functions return <STRONG>OK</STRONG> on success and <STRONG>ERR</STRONG> on failure.
81
82 In <EM>ncurses</EM>, they return <STRONG>ERR</STRONG> if
83
84 <STRONG>o</STRONG> <EM>win</EM> is <EM>NULL</EM>,
85
86 <STRONG>o</STRONG> <EM>str</EM> is <EM>NULL</EM>, or
87
88 <STRONG>o</STRONG> an internal <STRONG><A HREF="curs_insch.3x.html">winsch(3x)</A></STRONG> call returns <STRONG>ERR</STRONG>.
89
90 Functions prefixed with "mv" first perform cursor movement and fail if
91 the position (<EM>y</EM>, <EM>x</EM>) is outside the window boundaries.
92
93
94 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
95 All of these functions except <STRONG>winsnstr</STRONG> may be implemented as macros.
96
97
98 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
99 <STRONG>insnstr</STRONG>, <STRONG>winsnstr</STRONG>, <STRONG>mvinsnstr</STRONG>, and <STRONG>mvwinsnstr</STRONG>'s acceptance of negative <EM>n</EM>
100 values is an <EM>ncurses</EM> extension.
101
102
103 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
104 Applications employing <EM>ncurses</EM> extensions should condition their use on
105 the visibility of the <STRONG>NCURSES_VERSION</STRONG> preprocessor macro.
106
107 X/Open Curses Issue 4 describes these functions. It specifies no error
108 conditions for them.
109
110 SVr4 describes a successful return value only as "an integer value
111 other than <EM>ERR</EM>".
112
113 Issue 4 distinguished <EM>insnstr</EM> and <EM>winsnstr</EM> from the other functions
114 documented above by stating they "do not perform wrapping". This was
115 probably an error, since it makes this group of functions inconsistent.
116 No implementation of <EM>curses</EM> manifests this inconsistency, and Issue 7
117 removed the claim.
118
119 Issue 4 states that the entire string is inserted if <EM>n</EM> is less than 1.
120 This is probably an error, because it is inconsistent with other
121 functions such as <EM>waddstr</EM>, and differs from the SVr4 <EM>curses</EM> and Solaris
122 <EM>xcurses</EM> implementations. Nevertheless, Issue 7 retains the language.
123
124
125 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
126 SVr3.1 (1987) introduced <EM>winsstr</EM> and <EM>winsnstr</EM> and their variants.
127
128
129 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
130 <STRONG><A HREF="curs_ins_wstr.3x.html">curs_ins_wstr(3x)</A></STRONG> describes comparable functions of the <EM>ncurses</EM> library
131 in its wide-character configuration (<EM>ncursesw</EM>).
132
133 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_inch.3x.html">curs_inch(3x)</A></STRONG>, <STRONG><A HREF="curs_ins_wstr.3x.html">curs_ins_wstr(3x)</A></STRONG>, <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>
134
135 ncurses 6.6 2025-10-20 <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG>
136 </PRE>
137 <div class="nav">
138 <ul>
139 <li><a href="#h2-NAME">NAME</a></li>
140 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
141 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
142 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
143 <li><a href="#h2-NOTES">NOTES</a></li>
144 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
145 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
146 <li><a href="#h2-HISTORY">HISTORY</a></li>
147 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
148 </ul>
149 </div>
150 </BODY>
151 </HTML>