]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - man/curs_inchstr.3x
ncurses 6.4 - patch 20231118
[ncurses.git] / man / curs_inchstr.3x
index f174b09f71cc9ba83834d3432a02a7296e2d5b9a..89d4bd1e3d1fa272f8115331eceed66903322d6a 100644 (file)
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_inchstr.3x,v 1.32 2023/09/16 23:37:03 tom Exp $
-.TH curs_inchstr 3X 2023-09-16 "ncurses 6.4" "Library calls"
-.ie \n(.g .ds `` \(lq
-.el       .ds `` ``
-.ie \n(.g .ds '' \(rq
-.el       .ds '' ''
+.\" $Id: curs_inchstr.3x,v 1.40 2023/11/19 00:08:58 tom Exp $
+.TH curs_inchstr 3X 2023-11-18 "ncurses 6.4" "Library calls"
+.ie \n(.g \{\
+.ds `` \(lq
+.ds '' \(rq
+.\}
+.el \{\
+.ie t .ds `` ``
+.el   .ds `` ""
+.ie t .ds '' ''
+.el   .ds '' ""
+.\}
+.
 .de bP
 .ie n  .IP \(bu 4
 .el    .IP \(bu 2
 \fB\%mvwinchnstr\fP \-
 get a \fIcurses\fR character string from a window
 .SH SYNOPSIS
-\fB#include <curses.h>\fP
-.sp
-\fBint inchstr(chtype *\fIchstr\fB);\fR
-.br
-\fBint inchnstr(chtype *\fIchstr\fB, int \fIn\fB);\fR
-.br
-\fBint winchstr(WINDOW *\fIwin\fB, chtype *\fIchstr\fB);\fR
-.br
-\fBint winchnstr(WINDOW *\fIwin\fB, chtype *\fIchstr\fB, int \fIn\fB);\fR
-.sp
-\fBint mvinchstr(int \fIy\fB, int \fIx\fB, chtype *\fIchstr\fB);\fR
-.br
-\fBint mvinchnstr(int \fIy\fB, int \fIx\fB, chtype *\fIchstr\fB, int \fIn\fB);\fR
-.br
-\fBint mvwinchstr(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype *\fIchstr\fB);\fR
-.br
-\fBint mvwinchnstr(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype *\fIchstr\fB, int \fIn\fB);\fR
+.nf
+\fB#include <curses.h>
+.PP
+\fBint inchstr(chtype *\fIchstr\fP);
+\fBint inchnstr(chtype *\fIchstr\fP, int \fIn\fP);
+\fBint winchstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP);
+\fBint winchnstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP, int \fIn\fP);
+.PP
+\fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
+\fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
+\fBint mvwinchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
+\fBint mvwinchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
+.fi
 .SH DESCRIPTION
 These routines return a NULL-terminated array of \fBchtype\fP quantities,
 starting at the current cursor position in the named window and ending at the
 right margin of the window.
-The four functions with \fIn\fP as
-the last argument, return a leading substring at most \fIn\fP characters long
+.PP
+The four functions with \fIn\fP as the last argument, return
+a leading substring at most \fIn\fP characters long
 (exclusive of the trailing (chtype)0).
+Transfer stops at the end of the current line, or when \fIn\fP characters have
+been stored at the location referenced by \fIchstr\fP.
+.PP
 Constants defined in \fB<curses.h>\fP can be used with the \fB&\fP (logical
 AND) operator to extract the character or the attribute alone from any position
 in the \fIchstr\fP [see \fBcurs_inch\fP(3X)].
@@ -81,21 +88,38 @@ other than \fBERR\fP upon successful completion (the number of characters
 retrieved, exclusive of the trailing 0).
 .PP
 X/Open Curses defines no error conditions.
-In this implementation:
+This implementation returns an error
 .bP
-If the \fIwin\fP parameter is null, an error is returned,
+if the \fIwin\fP parameter is null or
 .bP
-If the \fIchstr\fP parameter is null, an error is returned,
+if the \fIchstr\fP parameter is null.
 .PP
 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
 \fBwmove\fP, and return an error if the position is outside the window,
 or if the window pointer is null.
 .SH NOTES
-Note that all routines except \fBwinchnstr\fP may be macros.
+All routines except \fBwinchnstr\fP may be macros.
+.PP
 SVr4 does not
 document whether the result string is zero-terminated; it does not document
 whether a length limit argument includes any trailing 0; and it does not
 document the meaning of the return value.
+.PP
+Reading a line that overflows the array pointed to by
+\fIchstr\fP
+with
+\fBinchstr\fP,
+\fBmvinchstr\fP,
+\fBmvwinchstr\fP
+or
+\fBwinchstr\fP
+causes undefined results.
+Therefore, the use of
+\fBinchnstr\fP,
+\fBmvinchnstr\fP,
+\fBmvwinchnstr\fP, or
+\fBwinchnstr\fP
+is recommended.
 .SH PORTABILITY
 These functions are described in the XSI Curses standard, Issue 4.
 It is no
@@ -103,8 +127,7 @@ more specific than the SVr4 documentation on the trailing 0.
 It does specify
 that the successful return of the functions is \fBOK\fP.
 .SH SEE ALSO
-\fBcurses\fP(3X), \fBcurs_inch\fP(3X).
-.PP
-Comparable functions in the wide-character (ncursesw) library are
-described in
-\fBcurs_in_wchstr\fP(3X).
+\fB\%curses\fP(3X),
+\fB\%curs_inch\fP(3X),
+\fB\%curs_inwstr\fP(3X),
+\fB\%curs_in_wchstr\fP(3X)