xref: /netbsd-src/lib/libmenu/menu_new.3 (revision 01869ca4d24a86379a68731bf9706a9f0820fe4e)
1*01869ca4Swiz.\"	$NetBSD: menu_new.3,v 1.11 2017/07/03 21:32:50 wiz Exp $
268f24b78Skleink.\"
3b68c50bcSblymn.\" Copyright (c) 1999
4b68c50bcSblymn.\"	Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
5b68c50bcSblymn.\"
6b68c50bcSblymn.\" This code is donated to The NetBSD Foundation by the author.
7b68c50bcSblymn.\"
8b68c50bcSblymn.\" Redistribution and use in source and binary forms, with or without
9b68c50bcSblymn.\" modification, are permitted provided that the following conditions
10b68c50bcSblymn.\" are met:
11b68c50bcSblymn.\" 1. Redistributions of source code must retain the above copyright
12b68c50bcSblymn.\"    notice, this list of conditions and the following disclaimer.
13b68c50bcSblymn.\" 2. Redistributions in binary form must reproduce the above copyright
14b68c50bcSblymn.\"    notice, this list of conditions and the following disclaimer in the
15b68c50bcSblymn.\"    documentation and/or other materials provided with the distribution.
16b68c50bcSblymn.\" 3. The name of the Author may not be used to endorse or promote
17b68c50bcSblymn.\"    products derived from this software without specific prior written
18b68c50bcSblymn.\"    permission.
19b68c50bcSblymn.\"
20b68c50bcSblymn.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21b68c50bcSblymn.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22b68c50bcSblymn.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23b68c50bcSblymn.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
24b68c50bcSblymn.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25b68c50bcSblymn.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26b68c50bcSblymn.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27b68c50bcSblymn.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28b68c50bcSblymn.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29b68c50bcSblymn.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30b68c50bcSblymn.\" SUCH DAMAGE.
31b68c50bcSblymn.\"
321a71a68bSwiz.Dd September 10, 1999
33b68c50bcSblymn.Dt MENU_NEW 3
341a71a68bSwiz.Os
35b68c50bcSblymn.Sh NAME
36b68c50bcSblymn.Nm free_menu ,
37b68c50bcSblymn.Nm new_menu
381a71a68bSwiz.Nd create or delete a menu
39b68c50bcSblymn.Sh LIBRARY
40b68c50bcSblymn.Lb libmenu
41b68c50bcSblymn.Sh SYNOPSIS
42472351e1Swiz.In menu.h
43b68c50bcSblymn.Ft int
44b68c50bcSblymn.Fn free_menu "MENU *menu"
45b68c50bcSblymn.Ft MENU *
466f430717Sjdf.Fn new_menu "ITEM **items"
47b68c50bcSblymn.Sh DESCRIPTION
48b68c50bcSblymnThe
49b68c50bcSblymn.Fn free_menu
50b68c50bcSblymn.Fa menu
51b68c50bcSblymnfunction destroys the given menu and frees all allocated storage
5257a4de98Swizassociated with the menu.
5357a4de98SwizAll items associated with the menu are
5457a4de98Swizdetached from the menu before it is destroyed.
5557a4de98SwizThe
56b68c50bcSblymn.Fn new_menu
5747c1285aSwizfunction allocates storage for a new menu and initializes all the
5857a4de98Swizvalues to the defined defaults.
5957a4de98SwizIf the items pointer passed is not a NULL then the given NULL terminated
6057a4de98Swizarray of items is attached to the new menu.
61b68c50bcSblymn.Sh RETURN VALUES
62b68c50bcSblymnThe
63b68c50bcSblymn.Fn new_menu
641a71a68bSwizfunction returns NULL on error, while the
651a71a68bSwiz.Fn free_menu
661a71a68bSwizfunction returns one of the following error values:
67b68c50bcSblymn.Pp
681a71a68bSwiz.Bl -tag -width E_BAD_ARGUMENT -compact
691a71a68bSwiz.It Er E_OK
701a71a68bSwizThe function was successful.
711a71a68bSwiz.It Er E_BAD_ARGUMENT
721a71a68bSwizOne or more of the arguments passed to the function was incorrect.
731a71a68bSwiz.It Er E_POSTED
741a71a68bSwizThe menu is already posted.
751a71a68bSwiz.El
76b68c50bcSblymn.Sh SEE ALSO
77b68c50bcSblymn.Xr curses 3 ,
78b68c50bcSblymn.Xr menus 3
79b68c50bcSblymn.Sh NOTES
80b68c50bcSblymnThe header
81*01869ca4Swiz.Pa <menu.h>
82b68c50bcSblymnautomatically includes both
83*01869ca4Swiz.Pa <curses.h>
84b68c50bcSblymnand
85*01869ca4Swiz.Pa <eti.h> .
86