]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2006-04-30 Marco Gerards <marco@gnu.org>
authormarco_g <marco_g@localhost>
Sun, 30 Apr 2006 20:29:51 +0000 (20:29 +0000)
committermarco_g <marco_g@localhost>
Sun, 30 Apr 2006 20:29:51 +0000 (20:29 +0000)
* 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.

ChangeLog
normal/execute.c

index 9af6dcb86b5229e8ca24a3f2e22f29a484155d46..2d4d62559de6ed0939c3c9ad8e31eae93bb7e156 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
index fe28876aeb5b0d4bf7184761a2a34d861b763fe9..9f28bd3a69a4742d11f21bceced9b014ded8be0c 100644 (file)
 #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
@@ -104,7 +103,24 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
       /* 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)