]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/mitem_new.3x
ncurses 6.2 - patch 20210626
[ncurses.git] / man / mitem_new.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2019,2020 Thomas E. Dickey                                *
4 .\" Copyright 1998-2010,2015 Free Software Foundation, Inc.                  *
5 .\"                                                                          *
6 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
7 .\" copy of this software and associated documentation files (the            *
8 .\" "Software"), to deal in the Software without restriction, including      *
9 .\" without limitation the rights to use, copy, modify, merge, publish,      *
10 .\" distribute, distribute with modifications, sublicense, and/or sell       *
11 .\" copies of the Software, and to permit persons to whom the Software is    *
12 .\" furnished to do so, subject to the following conditions:                 *
13 .\"                                                                          *
14 .\" The above copyright notice and this permission notice shall be included  *
15 .\" in all copies or substantial portions of the Software.                   *
16 .\"                                                                          *
17 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24 .\"                                                                          *
25 .\" Except as contained in this notice, the name(s) of the above copyright   *
26 .\" holders shall not be used in advertising or otherwise to promote the     *
27 .\" sale, use or other dealings in this Software without prior written       *
28 .\" authorization.                                                           *
29 .\"***************************************************************************
30 .\"
31 .\" $Id: mitem_new.3x,v 1.19 2020/10/18 00:37:03 tom Exp $
32 .TH mitem_new 3X ""
33 .SH NAME
34 \fBnew_item\fP,
35 \fBfree_item\fR \- create and destroy menu items
36 .SH SYNOPSIS
37 \fB#include <menu.h>\fR
38 .sp
39 \fBITEM *new_item(const char *\fP\fIname\fP\fB, const char *\fP\fIdescription\fP\fB);\fP
40 .br
41 \fBint free_item(ITEM *\fP\fIitem\fP\fB);\fP
42 .br
43 .SH DESCRIPTION
44 The function \fBnew_item\fR allocates a new item and initializes it from the
45 \fBname\fR and \fBdescription\fR pointers.
46 Please notice that the item stores
47 only the pointers to the name and description.
48 Those pointers must be valid
49 during the lifetime of the item.
50 So you should be very careful with names
51 or descriptions allocated on the stack of some routines.
52 .br
53 The function \fBfree_item\fR de-allocates an item.
54 Please notice that it
55 is the responsibility of the application to release the memory for the
56 name or the description of the item.
57 .SH RETURN VALUE
58 The function \fBnew_item\fR returns \fBNULL\fR on error.
59 It sets \fBerrno\fP according to the function's failure:
60 .TP 5
61 .B E_BAD_ARGUMENT
62 Routine detected an incorrect or out-of-range argument.
63 .TP 5
64 .B E_SYSTEM_ERROR
65 System error occurred, e.g., malloc failure.
66 .PP
67 The function \fBfree_item\fR returns one of the following:
68 .TP 5
69 .B E_OK
70 The routine succeeded.
71 .TP 5
72 .B E_BAD_ARGUMENT
73 Routine detected an incorrect or out-of-range argument.
74 .TP 5
75 .B E_CONNECTED
76 Item is connected to a menu.
77 .TP 5
78 .B E_SYSTEM_ERROR
79 System error occurred (see \fBerrno\fR(3)).
80 .SH SEE ALSO
81 \fBcurses\fR(3X), \fBmenu\fR(3X).
82 .SH NOTES
83 The header file \fB<menu.h>\fR automatically includes the header file
84 \fB<curses.h>\fR.
85 .SH PORTABILITY
86 These routines emulate the System V menu library.
87 They were not supported on
88 Version 7 or BSD versions.
89 .SH AUTHORS
90 Juergen Pfeifer.
91 Manual pages and adaptation for new curses by Eric S. Raymond.