1 /* -*- c -*- ------------------------------------------------------------- *
2 *
3 * Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13 #ifndef NULL
14 #define NULL ((void *) 0)
15 #endif
16
17 #include "cmenu.h"
18 #include "com32io.h"
19 #include <string.h>
20
main(void)21 int main(void)
22 {
23 t_menuitem *curr;
24
25 // Change the video mode here
26 // setvideomode(0)
27
28 // Choose the default title and setup default values for all attributes....
29 init_menusystem(NULL);
30 set_window_size(1, 1, 23, 78); // Leave one row/col border all around
31
32 // Choose the default values for all attributes and char's
33 // -1 means choose defaults (Actually the next 4 lines are not needed)
34 //set_normal_attr (-1,-1,-1,-1);
35 //set_status_info (-1,-1);
36 //set_title_info (-1,-1);
37 //set_misc_info(-1,-1,-1,-1);
38
39 // menuindex = add_named_menu("name"," Menu Title ",-1);
40 // add_item("Item string","Status String",TYPE,"any string",NUM)
41 // TYPE = OPT_RUN | OPT_EXITMENU | OPT_SUBMENU | OPT_CHECKBOX | OPT_INACTIVE
42 // "any string" useful for storing kernel names
43 // In case of OPT_SUBMENU, "any string" can be set to "name" of menu to be linked
44 // in which case value NUM is ignored
45 // NUM = index of submenu if OPT_SUBMENU,
46 // 0/1 default checked state if OPT_CHECKBOX
47 // unused otherwise.
48
49 add_named_menu("testing", " Testing ", -1);
50 add_item("Self Loop", "Go to testing", OPT_SUBMENU, "testing", 0);
51 add_item("Memory Test", "Perform extensive memory testing", OPT_RUN,
52 "memtest", 0);
53 add_item("Exit this menu", "Go one level up", OPT_EXITMENU, "exit", 0);
54
55 add_named_menu("rescue", " Rescue Options ", -1);
56 add_item("Linux Rescue", "linresc", OPT_RUN, "linresc", 0);
57 add_item("Dos Rescue", "dosresc", OPT_RUN, "dosresc", 0);
58 add_item("Windows Rescue", "winresc", OPT_RUN, "winresc", 0);
59 add_item("Exit this menu", "Go one level up", OPT_EXITMENU, "exit", 0);
60
61 add_named_menu("main", " Main Menu ", -1);
62 add_item("Prepare", "prep", OPT_RUN, "prep", 0);
63 add_item("Rescue options...", "Troubleshoot a system", OPT_SUBMENU,
64 "rescue", 0);
65 add_item("Testing...", "Options to test hardware", OPT_SUBMENU, "testing",
66 0);
67 add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
68
69 curr = showmenus(find_menu_num("main")); // Initial menu is the one called "main"
70
71 if (curr) {
72 if (curr->action == OPT_RUN) {
73 if (issyslinux())
74 runsyslinuxcmd(curr->data);
75 else
76 csprint(curr->data, 0x07);
77 return 1;
78 }
79 csprint("Error in programming!", 0x07);
80 }
81 return 0;
82 }
83