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
27 extern WINDOW *sub_for_menu;
28 extern char set_oeminfo_allowed;
30 void uni_menu(struct umitems *umenu, int num)
32 ITEM **menu_item = calloc(num+1, sizeof(ITEM));
34 char item_tmp[num][MCOLS];
35 unsigned short int idx;
38 for (idx = 0; idx < num-1; idx++) {
39 strncpy(item_tmp[idx], umenu[idx].item, MCOLS-1);
40 item_tmp[idx][MCOLS-3]='\0';
41 menu_item[idx] = new_item(item_tmp[idx], 0);
44 menu = new_menu(menu_item);
46 set_menu_opts(menu, O_ONEVALUE);
52 print_help(umenu[0].help);
55 wrefresh(sub_for_menu);
60 menu_driver(menu, REQ_NEXT_ITEM);
65 menu_driver(menu, REQ_LAST_ITEM);
70 menu_driver(menu, REQ_FIRST_ITEM);
75 menu_driver(menu, REQ_PREV_ITEM);
79 menu_driver(menu, REQ_FIRST_ITEM);
83 menu_driver(menu, REQ_LAST_ITEM);
91 if (set_oeminfo_allowed) {
92 set_menu_mark(menu, " ");
93 set_menu_fore(menu, A_NORMAL);
94 wrefresh(sub_for_menu);
96 set_menu_mark(menu, "-");
97 set_menu_fore(menu, A_STANDOUT);
102 idx = item_index(current_item(menu));
104 if (idx == num - 2) {
107 for (c = 0; c < num; c++)
108 free_item(menu_item[c]);
116 if (umenu[idx].is_menu)
121 if (umenu[idx].is_menu)
128 print_help(umenu[item_index(current_item(menu))].help);