/* menuentry.c - menuentry command */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
{
{"users", 2, 0,
{"hotkey", 3, 0,
{"source", 4, 0,
{0, 0, 0, 0, 0, 0}
};
static struct
{
const char *name;
int key;
} hotkey_aliases[] =
{
{"backspace", '\b'},
{"tab", '\t'},
{"delete", GRUB_TERM_KEY_DC},
{"insert", GRUB_TERM_KEY_INSERT},
{"f1", GRUB_TERM_KEY_F1},
{"f2", GRUB_TERM_KEY_F2},
{"f3", GRUB_TERM_KEY_F3},
{"f4", GRUB_TERM_KEY_F4},
{"f5", GRUB_TERM_KEY_F5},
{"f6", GRUB_TERM_KEY_F6},
{"f7", GRUB_TERM_KEY_F7},
{"f8", GRUB_TERM_KEY_F8},
{"f9", GRUB_TERM_KEY_F9},
{"f10", GRUB_TERM_KEY_F10},
{"f11", GRUB_TERM_KEY_F11},
{"f12", GRUB_TERM_KEY_F12},
};
/* Add a menu entry to the current menu context (as given by the environment
variable data slot `menu'). As the configuration file is read, the script
parser calls this when a menu entry is to be created. */
const char *prefix, const char *sourcecode,
int submenu)
{
int menu_hotkey = 0;
menu = grub_env_get_menu ();
if (! menu)
if (! menu_sourcecode)
return grub_errno;
{
int i;
for (i = 0; classes[i]; i++); /* count # of menuentry classes */
if (! menu_classes)
goto fail;
for (i = 0; classes[i]; i++)
{
if (! menu_classes[i].name)
goto fail;
}
}
if (users)
{
if (! menu_users)
goto fail;
}
if (hotkey)
{
unsigned i;
for (i = 0; i < ARRAY_SIZE (hotkey_aliases); i++)
{
break;
}
if (i == ARRAY_SIZE (hotkey_aliases))
menu_hotkey = hotkey[0];
}
if (! argc)
{
goto fail;
}
if (! menu_title)
goto fail;
/* Save argc, args to pass as parameters to block arg later. */
if (! menu_args)
goto fail;
{
int i;
for (i = 0; i < argc; i++)
{
if (! menu_args[i])
goto fail;
}
}
/* Add the menu entry at the end of the list. */
while (*last)
if (! *last)
goto fail;
if (menu_users)
return GRUB_ERR_NONE;
fail:
{
int i;
}
{
int i;
}
return grub_errno;
}
static char *
{
int i;
int j;
char *p;
char *result;
/* Count resulting string length */
for (i = 0; i < argc; i++)
{
p = args[i];
while (*p)
}
if (! result)
return 0;
p = result + 9;
for (j = 0; j < argc; j++)
{
*p++ = ' ';
*p++ = '\'';
*p++ = '\'';
}
*p++ = '\n';
*p = '\0';
return result;
}
static grub_err_t
{
char ch;
char *src;
char *prefix;
unsigned len;
grub_err_t r;
if (! argc)
if (! prefix)
return grub_errno;
return r;
}
void
grub_menu_init (void)
{
options);
}
void
grub_menu_fini (void)
{
}