2 * menu.c from Access Point SNMP Utils for Linux
4 * Copyright (c) 2002 Roman Festchook <roma at polesye dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License Version 2 from
8 * June 1991 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 extern WINDOW *sub_for_menu;
28 void uni_menu(struct umitems *umenu, int num)
30 ITEM **menu_item = calloc(num+1, sizeof(ITEM));
32 unsigned short int idx;
35 for (idx = 0; idx < num; idx++) {
36 menu_item[idx] = new_item(umenu[idx].item, 0);
38 menu = new_menu(menu_item);
40 set_menu_opts(menu, O_ONEVALUE);
46 wrefresh(sub_for_menu);
47 print_help(umenu[0].help);
54 menu_driver(menu, REQ_NEXT_ITEM);
55 wrefresh(sub_for_menu);
60 menu_driver(menu, REQ_LAST_ITEM);
61 wrefresh(sub_for_menu);
66 menu_driver(menu, REQ_FIRST_ITEM);
67 wrefresh(sub_for_menu);
72 menu_driver(menu, REQ_PREV_ITEM);
73 wrefresh(sub_for_menu);
77 menu_driver(menu, REQ_FIRST_ITEM);
78 wrefresh(sub_for_menu);
82 menu_driver(menu, REQ_LAST_ITEM);
83 wrefresh(sub_for_menu);
91 idx = item_index(current_item(menu));
96 for (c = 0; c < num; c++)
97 free_item(menu_item[c]);
105 if (umenu[idx].is_menu)
108 if (umenu[idx].is_menu) {
110 wrefresh(sub_for_menu);
116 print_help(umenu[item_index(current_item(menu))].help);