1 /* ----------------------------------------------------------------------- *
3 * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
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., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
16 * Header file for the simple menu system
24 #include <sys/times.h>
36 # define CLK_TCK sysconf(_SC_CLK_TCK)
41 /* Note: the _UNRES variants must always be immediately after their
44 MA_NONE
, /* Undefined value */
45 MA_CMD
, /* Execute a command */
46 MA_DISABLED
, /* Disabled menu entry */
47 MA_SUBMENU
, /* This is a submenu entry */
48 MA_GOTO
, /* Go to another menu */
49 MA_GOTO_UNRES
, /* Unresolved go to */
50 MA_QUIT
, /* Quit to CLI */
51 MA_EXIT
, /* Exit to higher-level menu */
52 MA_EXIT_UNRES
, /* Unresolved exit */
53 MA_HELP
, /* Show help text */
57 struct menu
*menu
; /* Parent menu */
58 const char *displayname
;
63 const char *background
;
65 struct menu_entry
*next
; /* Linked list of all labels across menus */
66 int entry
; /* Entry number inside menu */
67 enum menu_action action
;
69 bool immediate
; /* Hotkey action does not require Enter */
70 bool save
; /* Save this entry if selected */
73 static inline bool is_disabled(struct menu_entry
*me
)
75 return me
->action
== MA_DISABLED
;
79 /* Meta-types for internal use */
83 /* The ones we can pass off to SYSLINUX, in order */
84 KT_KERNEL
, /* Undefined type */
85 KT_LINUX
, /* Linux kernel */
86 KT_BOOT
, /* Bootstrap program */
87 KT_BSS
, /* Boot sector with patch */
89 KT_FDIMAGE
, /* Floppy disk image */
90 KT_COM32
, /* COM32 image */
91 KT_CONFIG
, /* Configuration file */
94 /* Configurable integer parameters */
95 enum parameter_number
{
114 /* Configurable messages */
115 enum message_number
{
126 const char *name
; /* Message configuration name */
127 const char *defmsg
; /* Default message text */
130 struct menu_parameter
{
135 extern const struct menu_parameter mparm
[NPARAMS
];
138 const char *textname
;
139 const char *background
;
143 struct menu
*next
; /* Linked list of all menus */
144 const char *label
; /* Goto label for this menu */
146 struct menu_entry
*parent_entry
; /* Entry for self in parent */
148 struct menu_entry
**menu_entries
;
149 struct menu_entry
*menu_hotkeys
[256];
151 const char *messages
[MSG_COUNT
];
160 bool immediate
; /* MENU IMMEDIATE default for this menu */
161 bool save
; /* MENU SAVE default for this menu */
167 const char *ontimeout
;
169 const char *menu_master_passwd
;
170 const char *menu_background
;
172 struct color_table
*color_table
;
174 struct fkey_help fkeyhelp
[12];
177 extern struct menu
*root_menu
, *start_menu
, *hide_menu
, *menu_list
;
179 /* 2048 is the current definition inside syslinux */
180 #define MAX_CMDLINE_LEN 2048
182 /* These are global parameters regardless of which menu we're displaying */
184 extern int hiddenmenu
;
185 extern int clearmenu
;
186 extern long long totaltimeout
;
187 extern clock_t kbdtimeout
;
188 extern const char *hide_key
[KEY_MAX
];
190 void parse_configs(char **argv
);
191 int draw_background(const char *filename
);
192 void set_resolution(int x
, int y
);
193 void start_console(void);
194 void local_cursor_enable(bool);
196 static inline int my_isspace(char c
)
198 return (unsigned char)c
<= ' ';
201 int my_isxdigit(char c
);
202 unsigned int hexval(char c
);
203 unsigned int hexval2(const char *p
);
204 uint32_t parse_argb(char **p
);
206 extern const int message_base_color
, menu_color_table_size
;
207 int mygetkey(clock_t timeout
);
208 int show_message_file(const char *filename
, const char *background
);
211 int passwd_compare(const char *passwd
, const char *entry
);
214 #define MSG_COLORS_DEF_FG 0x90ffffff
215 #define MSG_COLORS_DEF_BG 0x80ffffff
216 #define MSG_COLORS_DEF_SHADOW SHADOW_NORMAL
217 void set_msg_colors_global(struct color_table
*tbl
,
218 unsigned int fg
, unsigned int bg
,
219 enum color_table_shadow shadow
);
220 struct color_table
*default_color_table(void);
221 struct color_table
*copy_color_table(const struct color_table
*master
);
222 extern const int message_base_color
;
225 extern const char *current_background
;
226 void set_background(const char *new_background
);
229 void drain_keyboard(void);
232 void chainboot_file(const char *file
, enum kernel_type type
);