xref: /openbsd-src/lib/libmenu/m_userptr.c (revision a4afd6dad3fba28f80e70208181c06c482259988)
1 
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21 
22 /***************************************************************************
23 * Module menu_userptr                                                      *
24 * Associate application data with menus                                    *
25 ***************************************************************************/
26 
27 #include "menu.priv.h"
28 
29 /*---------------------------------------------------------------------------
30 |   Facility      :  libnmenu
31 |   Function      :  int set_menu_userptr(MENU *menu, char *userptr)
32 |
33 |   Description   :  Set the pointer that is reserved in any menu to store
34 |                    application relevant informations.
35 |
36 |   Return Values :  E_OK         - success
37 +--------------------------------------------------------------------------*/
38 int set_menu_userptr(MENU * menu, char * userptr)
39 {
40   Normalize_Menu(menu)->userptr = userptr;
41   RETURN( E_OK );
42 }
43 
44 /*---------------------------------------------------------------------------
45 |   Facility      :  libnmenu
46 |   Function      :  char *menu_userptr(const MENU *menu)
47 |
48 |   Description   :  Return the pointer that is reserved in any menu to
49 |                    store application relevant informations.
50 |
51 |   Return Values :  Value of the pointer. If no such pointer has been set,
52 |                    NULL is returned
53 +--------------------------------------------------------------------------*/
54 char *menu_userptr(const MENU * menu)
55 {
56   return( Normalize_Menu(menu)->userptr);
57 }
58 
59 /* m_userptr.c ends here */
60