+2006-04-30 Marco Gerards <marco@gnu.org>
+
+ * normal/execute.c (grub_script_execute_cmd): Change the return
+ type to `grub_err_t'. Correctly return the error.
+ (grub_script_execute_cmdline): In case a command line is not a
+ command or a function, try to interpret it as an assignment.
+
2006-04-30 Yoshinori K. Okuji <okuji@enbug.org>
* fs/hfsplus.c (grub_hfsplus_read_block): Fixed a memory leak.
#include <grub/env.h>
#include <grub/script.h>
-static int
+static grub_err_t
grub_script_execute_cmd (struct grub_script_cmd *cmd)
{
if (cmd == 0)
return 0;
- cmd->exec (cmd);
- return 0;
+ return cmd->exec (cmd);
}
/* Parse ARG and return the textual representation. Add strings are
/* It's not a GRUB command, try all functions. */
func = grub_script_function_find (cmdline->cmdname);
if (! func)
- return 0;
+ {
+ /* As a last resort, try if it is an assignment. */
+ char *assign = grub_strdup (cmdline->cmdname);
+ char *eq = grub_strchr (assign, '=');
+
+ if (eq)
+ {
+ /* Create two strings and set the variable. */
+ *eq = '\0';
+ eq++;
+ grub_env_set (assign, eq);
+
+ /* This was set because the command was not found. */
+ grub_errno = GRUB_ERR_NONE;
+ }
+ grub_free (assign);
+ return 0;
+ }
}
if (cmdline->arglist)