Debian Codegraph @

upstream/debian-trixie/man3/inchstr.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2024,2025 Thomas E. Dickey *
3 .\" Copyright 1998-2010,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_inchstr.3x,v 1.58 2025/02/15 14:55:35 tom Exp $
31 .TH inchstr 3NCURSES 2025-02-15 "ncurses 6.5" "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\%inchstr\fP,
49 \fB\%inchnstr\fP,
50 \fB\%winchstr\fP,
51 \fB\%winchnstr\fP,
52 \fB\%mvinchstr\fP,
53 \fB\%mvinchnstr\fP,
54 \fB\%mvwinchstr\fP,
55 \fB\%mvwinchnstr\fP \-
56 get a \fIcurses\fR character string from a window
57 .SH SYNOPSIS
58 .nf
59 \fB#include <curses.h>
60 .PP
61 \fBint inchstr(chtype *\fIchstr\fP);
62 \fBint inchnstr(chtype *\fIchstr\fP, int \fIn\fP);
63 \fBint winchstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP);
64 \fBint winchnstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP, int \fIn\fP);
65 .PP
66 \fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
67 \fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
68 \fBint mvwinchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
69 \fBint mvwinchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
70 .fi
71 .SH DESCRIPTION
72 These routines return a
73 .IR NULL -terminated
74 array of \fBchtype\fP quantities,
75 starting at the current cursor position in the named window and ending at the
76 right margin of the window.
77 .PP
78 The four functions with \fIn\fP as the last argument, return
79 a leading substring at most \fIn\fP characters long
80 (exclusive of the trailing (chtype)0).
81 Transfer stops at the end of the current line, or when \fIn\fP characters have
82 been stored at the location referenced by \fIchstr\fP.
83 .PP
84 Constants defined in \fB<curses.h>\fP can be used with the \fB&\fP
85 (logical \*(``and\*('')
86 operator to extract the character or the attribute alone from any position
87 in the \fIchstr\fP [see \fB\%inch\fP(3NCURSES)].
88 .SH RETURN VALUE
89 All routines return the integer \fBERR\fP upon failure and an integer value
90 other than \fBERR\fP upon successful completion (the number of characters
91 retrieved, exclusive of the trailing 0).
92 .PP
93 X/Open Curses defines no error conditions.
94 This implementation returns
95 .B ERR
96 .bP
97 if the \fIwin\fP parameter is null or
98 .bP
99 if the \fIchstr\fP parameter is null.
100 .PP
101 Functions prefixed with \*(``mv\*('' first perform cursor movement and
102 fail if the position
103 .RI ( y ,
104 .IR x )
105 is outside the window boundaries.
106 .SH NOTES
107 All of these functions except
108 .B \%winchnstr
109 may be implemented as macros.
110 .PP
111 Reading a line that overflows the array pointed to by
112 \fIchstr\fP
113 with
114 \fBinchstr\fP,
115 \fBmvinchstr\fP,
116 \fBmvwinchstr\fP
117 or
118 \fBwinchstr\fP
119 causes undefined results.
120 Therefore, the use of
121 \fBinchnstr\fP,
122 \fBmvinchnstr\fP,
123 \fBmvwinchnstr\fP, or
124 \fBwinchnstr\fP
125 is recommended.
126 .SH PORTABILITY
127 X/Open Curses Issue\ 4 describes these functions.
128 It specifies no error conditions for them.
129 It characterizes the strings stored by these functions as containing
130 \*(``at most
131 .I n
132 elements\*('' from a window,
133 .\" X/Open Issue 4, Version 2, p. 113, PDF p. 133
134 .\" Issue 7 doesn't change this wording at all.
135 but does not specify whether the string stored by these functions is
136 null-terminated.
137 .PP
138 SVr4 does not document whether it null-terminates the string it stores
139 in
140 .IR chstr ","
141 and does not document whether a trailing null character counts toward the
142 length limit
143 .IR n "."
144 .PP
145 SVr4 describes a successful return value only as
146 \*(``an integer value other than
147 .IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 503
148 .SH SEE ALSO
149 \fB\%ncurses\fP(3NCURSES),
150 \fB\%inch\fP(3NCURSES),
151 \fB\%inwstr\fP(3NCURSES),
152 \fB\%in_wchstr\fP(3NCURSES)