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;
27 extern char set_oeminfo_allowed;
29 void uni_menu(struct umitems *umenu, int num)
31 ITEM **menu_item = calloc(num+1, sizeof(ITEM));
33 unsigned short int idx;
36 for (idx = 0; idx < num; idx++) {
37 menu_item[idx] = new_item(umenu[idx].item, 0);
39 menu = new_menu(menu_item);
41 set_menu_opts(menu, O_ONEVALUE);
47 wrefresh(sub_for_menu);
48 print_help(umenu[0].help);
55 menu_driver(menu, REQ_NEXT_ITEM);
56 wrefresh(sub_for_menu);
61 menu_driver(menu, REQ_LAST_ITEM);
62 wrefresh(sub_for_menu);
67 menu_driver(menu, REQ_FIRST_ITEM);
68 wrefresh(sub_for_menu);
73 menu_driver(menu, REQ_PREV_ITEM);
74 wrefresh(sub_for_menu);
78 menu_driver(menu, REQ_FIRST_ITEM);
79 wrefresh(sub_for_menu);
83 menu_driver(menu, REQ_LAST_ITEM);
84 wrefresh(sub_for_menu);
92 if (set_oeminfo_allowed)
98 idx = item_index(current_item(menu));
100 if (idx == num - 2) {
103 for (c = 0; c < num; c++)
104 free_item(menu_item[c]);
112 if (umenu[idx].is_menu)
115 if (umenu[idx].is_menu) {
117 wrefresh(sub_for_menu);
123 print_help(umenu[item_index(current_item(menu))].help);