int i;
int no_mem_option = 0;
struct grub_command *cmd;
+ char **cutargs;
+ int cutargc;
for (i = 0; i < 2; i++)
{
/* FIXME: really support this. */
}
}
- if (!argc)
+ if (argc < 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename required");
+ cutargs = grub_malloc (sizeof (cutargsp[0]) * (argc - 1));
+ cutargc = argc - 1;
+ grub_memcpy (cutargs + 1, args + 2, sizeof (cutargsp[0]) * (argc - 2));
+ cutargs[0] = args[0];
+
do
{
/* First try Linux. */
cmd = grub_command_find ("linux16");
if (cmd)
{
- if (!(cmd->func) (cmd, argc, args))
+ if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = LINUX;
return GRUB_ERR_NONE;
cmd = grub_command_find ("kfreebsd");
if (cmd)
{
- if (!(cmd->func) (cmd, argc, args))
+ if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = KFREEBSD;
return GRUB_ERR_NONE;
cmd = grub_command_find ("knetbsd");
if (cmd)
{
- if (!(cmd->func) (cmd, argc, args))
+ if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = KNETBSD;
return GRUB_ERR_NONE;
cmd = grub_command_find ("kopenbsd");
if (cmd)
{
- if (!(cmd->func) (cmd, argc, args))
+ if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = KOPENBSD;
return GRUB_ERR_NONE;
TYPE_NOAPM_OPTION,
TYPE_TYPE_OR_NOMEM_OPTION,
TYPE_FILE,
+ TYPE_FILE_NO_CONSUME,
TYPE_PARTITION,
TYPE_BOOL,
TYPE_INT,
/* ifconfig unsupported. */
/* impsprobe unsupported. */
/* FIXME: dublicate multiboot filename. */
- {"initrd", "legacy_initrd '%s' %s\n", 2, {TYPE_FILE, TYPE_REST_VERBATIM}, 0,
+ {"initrd", "legacy_initrd '%s' %s\n", 2, {TYPE_FILE_NO_CONSUME,
+ TYPE_REST_VERBATIM}, 0,
"FILE [ARG ...]",
"Load an initial ramdisk FILE for a Linux format boot image and set the"
" appropriate parameters in the Linux setup area in memory."},
/* FIXME: really support --no-mem-option. */
/* FIXME: dublicate multiboot filename. */
{"kernel", "legacy_kernel %s %s '%s' %s\n", 4, {TYPE_TYPE_OR_NOMEM_OPTION,
- TYPE_TYPE_OR_NOMEM_OPTION,
- TYPE_FILE,
- TYPE_REST_VERBATIM}, 0,
+ TYPE_TYPE_OR_NOMEM_OPTION,
+ TYPE_FILE_NO_CONSUME,
+ TYPE_REST_VERBATIM}, 0,
"[--no-mem-option] [--type=TYPE] FILE [ARG ...]",
"Attempt to load the primary boot image from FILE. The rest of the"
" line is passed verbatim as the \"kernel command line\". Any modules"
" when you chain-load some operating systems, such as DOS, if such an"
" OS resides at a non-first drive."},
/* md5crypt unsupported. */
- {"module", "legacy_initrd '%s' %s\n", 1, {TYPE_FILE, TYPE_REST_VERBATIM}, 0,
+ {"module", "legacy_initrd '%s' %s\n", 1, {TYPE_FILE_NO_CONSUME,
+ TYPE_REST_VERBATIM}, 0,
"FILE [ARG ...]",
"Load a boot module FILE for a Multiboot format boot image (no"
" interpretation of the file contents is made, so users of this"
" compares them, to test the filesystem code. "
" If this test succeeds, then a good next"
" step is to try loading a kernel."},
- "Print the contents of the file FILE."},
/* testvbe unsupported. */
/* tftpserver unsupported. */
{"timeout", "set timeout=%s\n", 1, {TYPE_INT}, 0, "SEC",
ptr++;
switch (legacy_commands[cmdnum].argt[i])
{
+ case TYPE_FILE_NO_CONSUME:
+ hold_arg = 1;
case TYPE_PARTITION:
case TYPE_FILE:
args[j++] = adjust_file (curarg, curarglen);