xref: /minix3/lib/libcurses/curses_inch.3 (revision 0c3ae37f525eceade8dc047e551f5c9cb33faeb1)
1*0c3ae37fSLionel Sambuc.\"	$NetBSD: curses_inch.3,v 1.12 2011/08/07 11:37:06 wiz Exp $
251ffecc1SBen Gras.\"
351ffecc1SBen Gras.\" Copyright (c) 2002
451ffecc1SBen Gras.\"	Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
551ffecc1SBen Gras.\"
651ffecc1SBen Gras.\" This code is donated to the NetBSD Foundation by the Author.
751ffecc1SBen Gras.\"
851ffecc1SBen Gras.\" Redistribution and use in source and binary forms, with or without
951ffecc1SBen Gras.\" modification, are permitted provided that the following conditions
1051ffecc1SBen Gras.\" are met:
1151ffecc1SBen Gras.\" 1. Redistributions of source code must retain the above copyright
1251ffecc1SBen Gras.\"    notice, this list of conditions and the following disclaimer.
1351ffecc1SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
1451ffecc1SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
1551ffecc1SBen Gras.\"    documentation and/or other materials provided with the distribution.
1651ffecc1SBen Gras.\" 3. The name of the Author may not be used to endorse or promote
1751ffecc1SBen Gras.\"    products derived from this software without specific prior written
1851ffecc1SBen Gras.\"    permission.
1951ffecc1SBen Gras.\"
2051ffecc1SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
2151ffecc1SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2251ffecc1SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2351ffecc1SBen Gras.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
2451ffecc1SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2551ffecc1SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2651ffecc1SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2751ffecc1SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2851ffecc1SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2951ffecc1SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3051ffecc1SBen Gras.\" SUCH DAMAGE.
3151ffecc1SBen Gras.\"
3251ffecc1SBen Gras.\"
33*0c3ae37fSLionel Sambuc.Dd August 7, 2011
3451ffecc1SBen Gras.Dt CURSES_INCH 3
3551ffecc1SBen Gras.Os
3651ffecc1SBen Gras.Sh NAME
3751ffecc1SBen Gras.Nm curses_inch ,
3851ffecc1SBen Gras.Nm inch ,
3951ffecc1SBen Gras.Nm winch ,
4051ffecc1SBen Gras.Nm inchnstr ,
4151ffecc1SBen Gras.Nm mvinchnstr ,
4251ffecc1SBen Gras.Nm winchnstr ,
4351ffecc1SBen Gras.Nm mvwinchnstr ,
4451ffecc1SBen Gras.Nm inchstr ,
4551ffecc1SBen Gras.Nm mvinchstr ,
4651ffecc1SBen Gras.Nm winchstr ,
4751ffecc1SBen Gras.Nm mvwinchstr ,
4851ffecc1SBen Gras.Nm innstr ,
4951ffecc1SBen Gras.Nm winnstr ,
5051ffecc1SBen Gras.Nm mvinnstr ,
5151ffecc1SBen Gras.Nm mvwinnstr ,
5251ffecc1SBen Gras.Nm instr ,
5351ffecc1SBen Gras.Nm winstr
5451ffecc1SBen Gras.Nm mvinstr ,
5551ffecc1SBen Gras.Nm mvwinstr
5651ffecc1SBen Gras.Nd curses read screen contents routines
5751ffecc1SBen Gras.Sh LIBRARY
5851ffecc1SBen Gras.Lb libcurses
5951ffecc1SBen Gras.Sh SYNOPSIS
6051ffecc1SBen Gras.In curses.h
6151ffecc1SBen Gras.Ft chtype
6251ffecc1SBen Gras.Fn inch "void"
6351ffecc1SBen Gras.Ft chtype
6451ffecc1SBen Gras.Fn winch "WINDOW *win"
6551ffecc1SBen Gras.Ft int
6651ffecc1SBen Gras.Fn inchnstr "chtype *chars" "int n"
6751ffecc1SBen Gras.Ft int
6851ffecc1SBen Gras.Fn mvinchnstr "int y" "int x" "chtype *chstr" "int n"
6951ffecc1SBen Gras.Ft int
7051ffecc1SBen Gras.Fn winchnstr "WINDOW *win" "chtype *chars" "int n"
7151ffecc1SBen Gras.Ft int
7251ffecc1SBen Gras.Fn mvwinchnstr "WINDOW *win" "int y" "int x" "chtype *chstr" "int n"
7351ffecc1SBen Gras.Ft int
7451ffecc1SBen Gras.Fn inchstr "chtype *chars"
7551ffecc1SBen Gras.Ft int
7651ffecc1SBen Gras.Fn mvinchstr "int y" "int x" "chtype *chstr"
7751ffecc1SBen Gras.Ft int
7851ffecc1SBen Gras.Fn winchstr "WINDOW *win" "chtype *chars"
7951ffecc1SBen Gras.Ft int
8051ffecc1SBen Gras.Ft mvwinchstr "WINDOW *win" "int y" "int x" "chtype *chstr"
8151ffecc1SBen Gras.Ft int
8251ffecc1SBen Gras.Fn innstr "char *str" "int n"
8351ffecc1SBen Gras.Ft int
8451ffecc1SBen Gras.Fn winnstr "WINDOW *win" "char *str" "int n"
8551ffecc1SBen Gras.Ft int
8651ffecc1SBen Gras.Fn mvinnstr "int y" "int x" "char *str" "int n"
8751ffecc1SBen Gras.Ft int
8851ffecc1SBen Gras.Fn mvwinnstr "WINDOW *win" "int y" "int x" "char *str" "int n"
8951ffecc1SBen Gras.Ft int
9051ffecc1SBen Gras.Fn instr "char *str"
9151ffecc1SBen Gras.Ft int
9251ffecc1SBen Gras.Fn winstr "WINDOW *win" "char *str"
9351ffecc1SBen Gras.Ft int
9451ffecc1SBen Gras.Fn mvinstr "int y" "int x" "char *str"
9551ffecc1SBen Gras.Ft int
9651ffecc1SBen Gras.Fn mvwinstr "WINDOW *win" "int y" "int x" "char *str"
9751ffecc1SBen Gras.Sh DESCRIPTION
9851ffecc1SBen GrasThese functions read the contents of
9951ffecc1SBen Gras.Dv stdscr
10051ffecc1SBen Grasor of the specified window.
10151ffecc1SBen Gras.Pp
10251ffecc1SBen GrasThe
10351ffecc1SBen Gras.Fn inch
10451ffecc1SBen Grasfunction returns the character that is displayed on
10551ffecc1SBen Gras.Dv stdscr
10651ffecc1SBen Grasat the current cursor position.
10751ffecc1SBen Gras.Pp
10851ffecc1SBen GrasThe
10951ffecc1SBen Gras.Fn winch
11051ffecc1SBen Grasfunction is the same as the
11151ffecc1SBen Gras.Fn inch
11251ffecc1SBen Grasfunction, excepting that the character is read from window specified by
11351ffecc1SBen Gras.Fa win .
11451ffecc1SBen Gras.Pp
11551ffecc1SBen GrasThe
11651ffecc1SBen Gras.Fn inchnstr
11751ffecc1SBen Grasfunction fills an array of
11851ffecc1SBen Gras.Ft chtype
11951ffecc1SBen Graswith characters read from
12051ffecc1SBen Gras.Dv stdscr ,
12151ffecc1SBen Grasthe characters are read starting from the current cursor position and
12251ffecc1SBen Grascontinuing until either n \- 1 characters are read or the right hand
12351ffecc1SBen Grasside of the screen is reached.
12451ffecc1SBen GrasThe resulting character array will be
12551ffecc1SBen Gras.Dv NULL
12651ffecc1SBen Grasterminated.
12751ffecc1SBen Gras.Pp
12851ffecc1SBen GrasThe
12951ffecc1SBen Gras.Fn winchnstr
13051ffecc1SBen Grasfunction is the same as
13151ffecc1SBen Gras.Fn inchnstr
13251ffecc1SBen Grasexcepting that the characters are read from the window specified by
13351ffecc1SBen Gras.Fa win .
13451ffecc1SBen Gras.Pp
13551ffecc1SBen GrasThe
13651ffecc1SBen Gras.Fn inchstr
13751ffecc1SBen Grasand
13851ffecc1SBen Gras.Fn winchstr
13951ffecc1SBen Grasfunctions are the same as the
14051ffecc1SBen Gras.Fn inchnstr
14151ffecc1SBen Grasand
14251ffecc1SBen Gras.Fn winchnstr
14351ffecc1SBen Grasfunctions, respectively, excepting that they do not limit the number
14451ffecc1SBen Grasof characters read.
14551ffecc1SBen GrasThe characters returned are those from the current starting position to
14651ffecc1SBen Grasthe right hand side of the screen.
14751ffecc1SBen GrasThe use of
14851ffecc1SBen Gras.Fn inchstr
14951ffecc1SBen Grasand
15051ffecc1SBen Gras.Fn winchstr
15151ffecc1SBen Grasis not recommended as the character buffer can be overflowed.
15251ffecc1SBen Gras.Pp
15351ffecc1SBen GrasThe
15451ffecc1SBen Gras.Fn innstr
15551ffecc1SBen Grasfunction
15651ffecc1SBen Grasis similar to the
15751ffecc1SBen Gras.Fn inchstr
15851ffecc1SBen Grasfunction, excepting that the array of characters returned is stripped of all
15951ffecc1SBen Grasthe curses attributes making it a plain character string.
16051ffecc1SBen Gras.Pp
16151ffecc1SBen GrasThe
16251ffecc1SBen Gras.Fn mvinchstr ,
16351ffecc1SBen Gras.Fn mvinchnstr ,
16451ffecc1SBen Gras.Fn mvwinchstr ,
16551ffecc1SBen Grasand
16651ffecc1SBen Gras.Fn mvwinchnstr
16751ffecc1SBen Grasfunctions are the same as the
16851ffecc1SBen Gras.Fn inchstr ,
16951ffecc1SBen Gras.Fn inchnstr ,
17051ffecc1SBen Gras.Fn winchstr ,
17151ffecc1SBen Grasand
17251ffecc1SBen Gras.Fn winchstr
17351ffecc1SBen Grasfunctions, respectively, except that
17451ffecc1SBen Gras.Fn wmove
17551ffecc1SBen Grasis called to move the cursor to the position specified by
17651ffecc1SBen Gras.Fa y ,
17751ffecc1SBen Gras.Fa x
17851ffecc1SBen Grasbefore the output is printed on the window.
17951ffecc1SBen GrasLikewise, the
18051ffecc1SBen Gras.Fn mvinstr ,
18151ffecc1SBen Gras.Fn mvinnstr ,
18251ffecc1SBen Gras.Fn mvwinstr ,
18351ffecc1SBen Grasand
18451ffecc1SBen Gras.Fn mvwinnstr
18551ffecc1SBen Grasfunctions are the same as the
18651ffecc1SBen Gras.Fn instr ,
18751ffecc1SBen Gras.Fn innstr ,
18851ffecc1SBen Gras.Fn winstr ,
18951ffecc1SBen Grasand
19051ffecc1SBen Gras.Fn winstr
19151ffecc1SBen Grasfunctions, respectively, except that
19251ffecc1SBen Gras.Fn wmove
19351ffecc1SBen Grasis called to move the cursor to the position specified by
19451ffecc1SBen Gras.Fa y ,
19551ffecc1SBen Gras.Fa x
19651ffecc1SBen Grasbefore the output is printed on the window.
19751ffecc1SBen Gras.Pp
19851ffecc1SBen GrasThe
19951ffecc1SBen Gras.Fn winnstr
20051ffecc1SBen Grasfunction is the same as the
20151ffecc1SBen Gras.Fn innstr
20251ffecc1SBen Grasfunction, excepting that characters are read from the window specified by
20351ffecc1SBen Gras.Fa win .
20451ffecc1SBen Gras.Pp
20551ffecc1SBen GrasThe
20651ffecc1SBen Gras.Fn instr
20751ffecc1SBen Grasand
20851ffecc1SBen Gras.Fn winstr
20951ffecc1SBen Grasfunctions
21051ffecc1SBen Grasare the same as the
21151ffecc1SBen Gras.Fn innstr
21251ffecc1SBen Grasand
21351ffecc1SBen Gras.Fn winnstr
21451ffecc1SBen Grasfunctions, respectively, excepting that there are no limits placed on the
21551ffecc1SBen Grassize of the returned string, which may cause buffer overflows.
21651ffecc1SBen GrasFor this reason, the use of
21751ffecc1SBen Gras.Fn instr
21851ffecc1SBen Grasand
21951ffecc1SBen Gras.Fn winstr
22051ffecc1SBen Grasis not recommended.
22151ffecc1SBen Gras.Sh RETURN VALUES
222*0c3ae37fSLionel SambucIf the calls
223*0c3ae37fSLionel Sambuc.Fn innstr ,
224*0c3ae37fSLionel Sambuc.Fn mvinnstr ,
225*0c3ae37fSLionel Sambuc.Fn mvwinnstr ,
226*0c3ae37fSLionel Sambucand
227*0c3ae37fSLionel Sambuc.Fn winnstr
228*0c3ae37fSLionel Sambucsucceed then they will return the number of characters actually read.
22951ffecc1SBen GrasFunctions returning pointers will return
23051ffecc1SBen Gras.Dv NULL
23151ffecc1SBen Grasif an error is detected.
23251ffecc1SBen GrasThe functions that return an int will return one of the following
23351ffecc1SBen Grasvalues:
23451ffecc1SBen Gras.Pp
23551ffecc1SBen Gras.Bl -tag -width ERR -compact
23651ffecc1SBen Gras.It Er OK
23751ffecc1SBen GrasThe function completed successfully.
23851ffecc1SBen Gras.It Er ERR
23951ffecc1SBen GrasAn error occurred in the function.
24051ffecc1SBen Gras.El
24151ffecc1SBen Gras.Sh SEE ALSO
24251ffecc1SBen Gras.Xr curses_addch 3 ,
24351ffecc1SBen Gras.Xr curses_addstr 3 ,
24451ffecc1SBen Gras.Xr curses_attributes 3 ,
24551ffecc1SBen Gras.Xr curses_insertch 3
24651ffecc1SBen Gras.Sh STANDARDS
24751ffecc1SBen GrasThe
24851ffecc1SBen Gras.Nx
24951ffecc1SBen GrasCurses library complies with the X/Open Curses specification, part
25051ffecc1SBen Grasof the Single Unix Specification.
25151ffecc1SBen Gras.Sh NOTES
25251ffecc1SBen GrasThe
25351ffecc1SBen Gras.Fn inchnstr
25451ffecc1SBen Grasand
25551ffecc1SBen Gras.Fn innstr
25651ffecc1SBen Grasfunction read at most n \- 1 characters from the screen so as to leave
25751ffecc1SBen Grasroom for
25851ffecc1SBen Gras.Dv NULL
25951ffecc1SBen Grastermination.
26051ffecc1SBen GrasThe X/Open specification is unclear as to whether or not this is the correct
26151ffecc1SBen Grasbehaviour.
26251ffecc1SBen Gras.Sh HISTORY
26351ffecc1SBen GrasThe Curses package appeared in
26451ffecc1SBen Gras.Bx 4.0 .
265