2009-12-20 Vladimir Serbinenko <phcoder@gmail.com>

* kern/parser.c (grub_parser_split_cmdline): Fix incorrect counting
	of arguments. Return number of tokens and not arguments. All users
	updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-20 22:54:12 +01:00
parent de15bf8e7f
commit 3041d8989c
4 changed files with 26 additions and 10 deletions

View file

@ -409,13 +409,16 @@ grub_normal_do_completion (char *buf, int *restore,
if (grub_parser_split_cmdline (buf, 0, &argc, &argv))
return 0;
current_word = argv[argc];
if (argc == 0)
current_word = "";
else
current_word = argv[argc - 1];
/* Determine the state the command line is in, depending on the
state, it can be determined how to complete. */
cmdline_state = get_state (buf);
if (argc == 0)
if (argc == 1 || argc == 0)
{
/* Complete a command. */
if (grub_command_iterate (iterate_command))
@ -485,13 +488,15 @@ grub_normal_do_completion (char *buf, int *restore,
goto fail;
}
grub_free (argv[0]);
if (argc != 0)
grub_free (argv[0]);
grub_free (match);
return ret;
}
fail:
grub_free (argv[0]);
if (argc != 0)
grub_free (argv[0]);
grub_free (match);
grub_errno = GRUB_ERR_NONE;