Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 30 | .\" $Id: curs_inchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $ |
| 31 | .TH curs_inchstr 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 | . |
| 43 | .de bP |
| 44 | .ie n .IP \(bu 4 |
| 45 | .el .IP \(bu 2 |
| 46 | .. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 47 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 57 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 71 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 72 | These routines return a NULL-terminated array of \fBchtype\fP quantities, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | starting at the current cursor position in the named window and ending at the |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | right margin of the window. |
| 75 | .PP |
| 76 | The four functions with \fIn\fP as the last argument, return |
| 77 | a leading substring at most \fIn\fP characters long |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 78 | (exclusive of the trailing (chtype)0). |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 79 | Transfer stops at the end of the current line, or when \fIn\fP characters have |
| 80 | been stored at the location referenced by \fIchstr\fP. |
| 81 | .PP |
| 82 | Constants defined in \fB<curses.h>\fP can be used with the \fB&\fP (logical |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 83 | AND) operator to extract the character or the attribute alone from any position |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 84 | in the \fIchstr\fP [see \fBcurs_inch\fP(3X)]. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 85 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 86 | All routines return the integer \fBERR\fP upon failure and an integer value |
| 87 | other than \fBERR\fP upon successful completion (the number of characters |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 88 | retrieved, exclusive of the trailing 0). |
| 89 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 90 | X/Open Curses defines no error conditions. |
| 91 | This implementation returns an error |
| 92 | .bP |
| 93 | if the \fIwin\fP parameter is null or |
| 94 | .bP |
| 95 | if the \fIchstr\fP parameter is null. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 96 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 97 | Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 98 | fail if the position |
| 99 | .RI ( y , |
| 100 | .IR x ) |
| 101 | is outside the window boundaries. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 102 | .SH NOTES |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 103 | All routines except \fBwinchnstr\fP may be macros. |
| 104 | .PP |
| 105 | SVr4 does not |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 106 | document whether the result string is zero-terminated; it does not document |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 107 | whether a length limit argument includes any trailing 0; and it does not |
| 108 | document the meaning of the return value. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 109 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 110 | Reading a line that overflows the array pointed to by |
| 111 | \fIchstr\fP |
| 112 | with |
| 113 | \fBinchstr\fP, |
| 114 | \fBmvinchstr\fP, |
| 115 | \fBmvwinchstr\fP |
| 116 | or |
| 117 | \fBwinchstr\fP |
| 118 | causes undefined results. |
| 119 | Therefore, the use of |
| 120 | \fBinchnstr\fP, |
| 121 | \fBmvinchnstr\fP, |
| 122 | \fBmvwinchnstr\fP, or |
| 123 | \fBwinchnstr\fP |
| 124 | is recommended. |
| 125 | .SH PORTABILITY |
| 126 | These functions are described in X/Open Curses, Issue 4. |
| 127 | It is no |
| 128 | more specific than the SVr4 documentation on the trailing 0. |
| 129 | It does specify |
| 130 | that the successful return of the functions is \fBOK\fP. |
| 131 | .SH SEE ALSO |
| 132 | \fB\%curses\fP(3X), |
| 133 | \fB\%curs_inch\fP(3X), |
| 134 | \fB\%curs_inwstr\fP(3X), |
| 135 | \fB\%curs_in_wchstr\fP(3X) |