is sizeof (int) * 3, and one extra for a possible -ve sign. */
#define ERRNO_DIGITS_MAX (sizeof (int) * 3 + 1)
+static unsigned long is_continue;
static unsigned long active_loops;
static unsigned long active_breaks;
+
+ /* Scope for grub script functions. */
+ struct grub_script_scope
+ {
+ struct grub_script_argv argv;
+ };
static struct grub_script_scope *scope = 0;
grub_err_t
(*p != '\0'))
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad break");
- active_breaks = count;
+ is_continue = grub_strcmp (cmd->name, "break") ? 1 : 0;
-
+ active_breaks = grub_min (active_loops, count);
return GRUB_ERR_NONE;
}
active_loops++;
result = 0;
- for (i = 0; i < argcount; i++)
+ for (i = 0; i < argv.argc; i++)
{
+ if (is_continue && active_breaks == 1)
+ active_breaks = 0;
+
if (! active_breaks)
{
- grub_script_env_set (cmdfor->name->str, args[i]);
+ grub_script_env_set (cmdfor->name->str, argv.args[i]);
result = grub_script_execute_cmd (cmdfor->list);
}
- grub_free (args[i]);
}
if (active_breaks)