]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/commands/search_wrap.c (grub_cmd_search): Handle old
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 19 Apr 2012 09:32:59 +0000 (11:32 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 19 Apr 2012 09:32:59 +0000 (11:32 +0200)
--fs-uuid --set UUID syntax.

ChangeLog
grub-core/commands/search_wrap.c

index 42835cd628f0b60a2de8c491bad2a22bae005151..c16a7e9b8e6e3f31dba69ece8c37cf95d9f61a5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-18  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/commands/search_wrap.c (grub_cmd_search): Handle old
+       --fs-uuid --set UUID syntax.
+
 2012-04-18  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_write): Fix message
index 0ee5bfe8e2249777b27f9a42bb90b42316cdea33..3f75fecdf1d0b22890121beb6db643a1366ed2c7 100644 (file)
@@ -86,6 +86,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
 {
   struct grub_arg_list *state = ctxt->state;
   const char *var = 0;
+  const char *id = 0;
   int i = 0, j = 0, nhints = 0;
   char **hints = NULL;
 
@@ -163,20 +164,27 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
     if (grub_memcmp (args[j], "--hint-", sizeof ("--hint-") - 1) != 0)
       break;
 
-  if (argc == j)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
-
   if (state[SEARCH_SET].set)
     var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
 
+  if (argc != j)
+    id = args[j];
+  else if (state[SEARCH_SET].set && state[SEARCH_SET].arg)
+    {
+      id = state[SEARCH_SET].arg;
+      var = "root";
+    }
+  else
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
+
   if (state[SEARCH_LABEL].set)
-    grub_search_label (args[j], var, state[SEARCH_NO_FLOPPY].set, 
+    grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set, 
                       hints, nhints);
   else if (state[SEARCH_FS_UUID].set)
-    grub_search_fs_uuid (args[j], var, state[SEARCH_NO_FLOPPY].set,
+    grub_search_fs_uuid (id, var, state[SEARCH_NO_FLOPPY].set,
                         hints, nhints);
   else if (state[SEARCH_FILE].set)
-    grub_search_fs_file (args[j], var, state[SEARCH_NO_FLOPPY].set, 
+    grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, 
                         hints, nhints);
   else
     return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");