| 1 |
<!-- |
| 2 |
**************************************************************************** |
| 3 |
* Copyright 2018-2023,2024 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 |
* @Id: mitem_new.3x,v 1.38 2024/12/28 21:26:21 tom Exp @ |
| 31 |
--> |
| 32 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| 33 |
<HTML> |
| 34 |
<HEAD> |
| 35 |
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 36 |
<meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts"> |
| 37 |
<TITLE>mitem_new 3x 2024-12-28 ncurses 6.6 Library calls</TITLE> |
| 38 |
<link rel="author" href="mailto:[email protected]"> |
| 39 |
|
| 40 |
</HEAD> |
| 41 |
<BODY> |
| 42 |
<H1 class="no-header">mitem_new 3x 2024-12-28 ncurses 6.6 Library calls</H1> |
| 43 |
<PRE> |
| 44 |
<STRONG><A HREF="mitem_new.3x.html">mitem_new(3x)</A></STRONG> Library calls <STRONG><A HREF="mitem_new.3x.html">mitem_new(3x)</A></STRONG> |
| 45 |
|
| 46 |
|
| 47 |
</PRE><H2><a name="h2-NAME">NAME</a></H2><PRE> |
| 48 |
<STRONG>new_item</STRONG>, <STRONG>free_item</STRONG> - create and destroy menu items |
| 49 |
|
| 50 |
|
| 51 |
</PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE> |
| 52 |
<STRONG>#include</STRONG> <STRONG><menu.h></STRONG> |
| 53 |
|
| 54 |
<STRONG>ITEM</STRONG> <STRONG>*new_item(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>name</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>description</EM><STRONG>);</STRONG> |
| 55 |
<STRONG>int</STRONG> <STRONG>free_item(ITEM</STRONG> <STRONG>*</STRONG><EM>item</EM><STRONG>);</STRONG> |
| 56 |
|
| 57 |
|
| 58 |
</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE> |
| 59 |
The function <STRONG>new_item</STRONG> allocates a new item and initializes it from the |
| 60 |
<STRONG>name</STRONG> and <STRONG>description</STRONG> pointers. Please notice that the item stores only |
| 61 |
the pointers to the name and description. Those pointers must be valid |
| 62 |
during the lifetime of the item. So you should be very careful with |
| 63 |
names or descriptions allocated on the stack of some routines. |
| 64 |
The function <STRONG>free_item</STRONG> de-allocates an item. Please notice that it is |
| 65 |
the responsibility of the application to release the memory for the |
| 66 |
name or the description of the item. |
| 67 |
|
| 68 |
|
| 69 |
</PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE> |
| 70 |
The function <STRONG>new_item</STRONG> returns <EM>NULL</EM> on error. It sets <STRONG>errno</STRONG> according |
| 71 |
to the function's failure: |
| 72 |
|
| 73 |
<STRONG>E_BAD_ARGUMENT</STRONG> |
| 74 |
Routine detected an incorrect or out-of-range argument. |
| 75 |
|
| 76 |
<STRONG>E_SYSTEM_ERROR</STRONG> |
| 77 |
System error occurred, e.g., malloc failure. |
| 78 |
|
| 79 |
The function <STRONG>free_item</STRONG> returns one of the following: |
| 80 |
|
| 81 |
<STRONG>E_OK</STRONG> The routine succeeded. |
| 82 |
|
| 83 |
<STRONG>E_BAD_ARGUMENT</STRONG> |
| 84 |
Routine detected an incorrect or out-of-range argument. |
| 85 |
|
| 86 |
<STRONG>E_CONNECTED</STRONG> |
| 87 |
Item is connected to a menu. |
| 88 |
|
| 89 |
<STRONG>E_SYSTEM_ERROR</STRONG> |
| 90 |
System error occurred (see <STRONG>errno(3)</STRONG>). |
| 91 |
|
| 92 |
|
| 93 |
</PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> |
| 94 |
These routines emulate the System V menu library. They were not |
| 95 |
supported on Version 7 or BSD versions. |
| 96 |
|
| 97 |
|
| 98 |
</PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE> |
| 99 |
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. |
| 100 |
Raymond. |
| 101 |
|
| 102 |
|
| 103 |
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> |
| 104 |
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3x)</A></STRONG> |
| 105 |
|
| 106 |
ncurses 6.6 2024-12-28 <STRONG><A HREF="mitem_new.3x.html">mitem_new(3x)</A></STRONG> |
| 107 |
</PRE> |
| 108 |
<div class="nav"> |
| 109 |
<ul> |
| 110 |
<li><a href="#h2-NAME">NAME</a></li> |
| 111 |
<li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li> |
| 112 |
<li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li> |
| 113 |
<li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li> |
| 114 |
<li><a href="#h2-PORTABILITY">PORTABILITY</a></li> |
| 115 |
<li><a href="#h2-AUTHORS">AUTHORS</a></li> |
| 116 |
<li><a href="#h2-SEE-ALSO">SEE ALSO</a></li> |
| 117 |
</ul> |
| 118 |
</div> |
| 119 |
</BODY> |
| 120 |
</HTML> |