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 2019-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_insstr.3x,v 1.51 2024/04/20 21:20:07 tom Exp $ |
| 31 | .TH curs_insstr 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\%insstr\fP, |
| 49 | \fB\%insnstr\fP, |
| 50 | \fB\%winsstr\fP, |
| 51 | \fB\%winsnstr\fP, |
| 52 | \fB\%mvinsstr\fP, |
| 53 | \fB\%mvinsnstr\fP, |
| 54 | \fB\%mvwinsstr\fP, |
| 55 | \fB\%mvwinsnstr\fP \- |
| 56 | insert a string in a \fIcurses\fR 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 | \fBint insstr(const char *\fIstr\fP); |
| 61 | \fBint insnstr(const char *\fIstr\fP, int \fIn\fP); |
| 62 | \fBint winsstr(WINDOW *\fIwin\fP, const char *\fIstr\fP); |
| 63 | \fBint winsnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP); |
| 64 | .PP |
| 65 | \fBint mvinsstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); |
| 66 | \fBint mvinsnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); |
| 67 | \fBint mvwinsstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); |
| 68 | \fBint mvwinsnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); |
| 69 | .fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 70 | .SH DESCRIPTION |
| 71 | These routines insert a character string |
| 72 | (as many characters as will fit on the line) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 73 | before the character under the cursor, |
| 74 | as if calling \fBwinsch\fP(3X). |
| 75 | All characters to the right of the cursor are shifted right, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 76 | with the possibility of the rightmost characters on the line being lost. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 77 | No wrapping is performed. |
| 78 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 79 | The cursor position does not change |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 80 | (after moving to \fIy\fP, \fIx\fP, if specified). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 81 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 82 | The functions with \fIn\fP as the last argument |
| 83 | insert a leading substring of at most \fIn\fP characters. |
| 84 | If \fIn\fP is less than zero, the entire string is inserted |
| 85 | (stopping on a NUL character). |
| 86 | .PP |
| 87 | Special characters are handled as in \fBwaddch\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 88 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 89 | All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 90 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 91 | X/Open Curses does not specify any error conditions. |
| 92 | This implementation returns an error |
| 93 | .bP |
| 94 | if the \fIwin\fP parameter is null or |
| 95 | .bP |
| 96 | if the \fIstr\fP parameter is null or |
| 97 | .bP |
| 98 | the \fBwinsch\fP(3X) function returns an error. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 99 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 100 | Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 101 | fail if the position |
| 102 | .RI ( y , |
| 103 | .IR x ) |
| 104 | is outside the window boundaries. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 105 | .SH NOTES |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 106 | All but \fBwinsnstr\fP may be macros. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 107 | .SH PORTABILITY |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 108 | These functions are described in X/Open Curses, Issue 4, |
| 109 | which adds \fI\%const\fP qualifiers to the arguments. |
| 110 | .PP |
| 111 | The Single Unix Specification, Version 2 states that |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 112 | \fBinsnstr\fP and \fBwinsnstr\fP perform wrapping. |
| 113 | This is probably an error, since it makes this group of functions inconsistent. |
| 114 | Also, no implementation of curses documents this inconsistency. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 115 | .PP |
| 116 | X/Open states that the entire string is inserted if \fIn\fP is less than 1. |
| 117 | This is probably an error, |
| 118 | because it is inconsistent with other functions, |
| 119 | and differs from the SVr4 and X/Open implementations on Solaris. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 120 | .SH SEE ALSO |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 121 | \fB\%curses\fP(3X), |
| 122 | \fB\%curs_inch\fP(3X), |
| 123 | \fB\%curs_ins_wstr\fP(3X), |
| 124 | \fB\%curs_util\fP(3X) |