NetBSD/lib/libcurses/curses_addstr.3

160 lines
4.2 KiB
Groff

.\" $NetBSD: curses_addstr.3,v 1.4 2003/05/21 21:22:15 jdc 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 May 21, 2003
.Dt CURSES_ADDSTR 3
.Os
.Sh NAME
.Nm curses_addstr ,
.Nm addstr ,
.Nm waddstr ,
.Nm addnstr ,
.Nm waddnstr ,
.Nm mvaddstr ,
.Nm mvwaddstr ,
.Nm mvaddnstr ,
.Nm mvwaddnstr
.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 waddstr "WINDOW *win" "const char *string"
.Ft int
.Fn mvaddstr "int y" "int x" "const char *string"
.Ft int
.Fn mvwaddstr "WINDOW *win" "int y" "int x" "const char *string"
.Ft int
.Fn addnstr "const char *string" "int len"
.Ft int
.Fn waddnstr "WINDOW *win" "const char *string" "int len"
.Ft int
.Fn mvaddnstr "int y" "int x" "const char *string" "int len"
.Ft int
.Fn mvwaddnstr "WINDOW *win" "int y" "int x" "const char *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 .