NetBSD/lib/libcurses/curses_addstr.3

184 lines
4.8 KiB
Groff

.\" $NetBSD: curses_addstr.3,v 1.7 2019/07/28 14:28:50 sevan Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
.\"
.\" This code is donated to the NetBSD Foundation by the Author.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the Author may not be used to endorse or promote
.\" products derived from this software without specific prior written
.\" permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd July 28, 2019
.Dt CURSES_ADDSTR 3
.Os
.Sh NAME
.Nm curses_addstr ,
.Nm addstr ,
.Nm addwstr ,
.Nm waddstr ,
.Nm waddwstr ,
.Nm addnstr ,
.Nm addnwstr ,
.Nm waddnstr ,
.Nm waddnwstr ,
.Nm mvaddstr ,
.Nm mvaddwstr ,
.Nm mvwaddstr ,
.Nm mvwaddwstr ,
.Nm mvaddnstr ,
.Nm mvaddnwstr ,
.Nm mvwaddnstr ,
.Nm mvwaddnwstr
.Nd curses add character strings to windows routines
.Sh LIBRARY
.Lb libcurses
.Sh SYNOPSIS
.In curses.h
.Ft int
.Fn addstr "const char *string"
.Ft int
.Fn addwstr "const wchar_t *string"
.Ft int
.Fn waddstr "WINDOW *win" "const char *string"
.Ft int
.Fn waddwstr "WINDOW *win" "const wchar_t *string"
.Ft int
.Fn mvaddstr "int y" "int x" "const char *string"
.Ft int
.Fn mvaddwstr "int y" "int x" "const wchar_t *string"
.Ft int
.Fn mvwaddstr "WINDOW *win" "int y" "int x" "const char *string"
.Ft int
.Fn mvwaddwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len"
.Ft int
.Fn addnstr "const char *string" "int len"
.Ft int
.Fn addnwstr "const wchar_t *string" "int len"
.Ft int
.Fn waddnstr "WINDOW *win" "const char *string" "int len"
.Ft int
.Fn waddnwstr "WINDOW *win" "const wchar_t *string" "int len"
.Ft int
.Fn mvaddnstr "int y" "int x" "const char *string" "int len"
.Ft int
.Fn mvaddnwstr "int y" "int x" "const wchar_t *string" "int len"
.Ft int
.Fn mvwaddnstr "WINDOW *win" "int y" "int x" "const char *string" "int len"
.Ft int
.Fn mvwaddnwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len"
.Sh DESCRIPTION
These functions add character strings to
.Dv stdscr
or to the specified window.
.Pp
The
.Fn addstr
function
will add the characters passed in
.Fa string
to
.Dv stdscr
starting at the current cursor position.
Any background attributes currently set on
.Dv stdscr
will be applied to the added character.
The
.Fn waddstr
function does the same as
.Fn addstr
but adds the string to the window specified by
.Fn win .
.Pp
The
.Fn addnstr
function will add the contents of
.Fa string
to
.Dv stdscr
but will limit the number of characters added to be, at most,
.Fa len .
If
.Fa len
is \-1 then
.Fa addnstr
will add the number of characters contained in the null terminated string
.Fa string .
Any background attributes currently set on
.Dv stdscr
will be applied to the added character.
The
.Fn waddnstr
function
does the same as
.Fa addnstr
but adds the string to the window specified by
.Fa win .
.Pp
The functions
.Fn mvaddstr ,
.Fn mwaddnstr ,
.Fn mvwaddstr
and
.Fn mvwaddnstr
are the same as the functions
.Fn addstr ,
.Fn waddstr ,
.Fn waddstr
and
.Fn waddnstr ,
respectively, excepting that
.Fn wmove
is called to move the cursor to the position specified by
.Fa y ,
.Fa x
before the string is added to the window.
.Sh RETURN VALUES
Functions returning pointers will return
.Dv NULL
if an error is detected.
The functions that return an int will return one of the following
values:
.Pp
.Bl -tag -width ERR -compact
.It Er OK
The function completed successfully.
.It Er ERR
An error occurred in the function.
.El
.Sh SEE ALSO
.Xr curses_addch 3 ,
.Xr curses_addchstr 3 ,
.Xr curses_attributes 3 ,
.Xr curses_cursor 3 ,
.Xr curses_inch 3
.Sh STANDARDS
The
.Nx
Curses library complies with the X/Open Curses specification, part of the
Single Unix Specification.
.Sh HISTORY
The Curses package appeared in
.Bx 4.0 .