|
|
a5bd9f6 |
From c902417ff9033152f80cfddd55140bb4b216cfa5 Mon Sep 17 00:00:00 2001
|
|
|
a5bd9f6 |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
Date: Thu, 28 Feb 2013 09:43:25 +0100
|
|
|
a5bd9f6 |
Subject: [PATCH 164/364] * grub-core/commands/parttool.c
|
|
|
a5bd9f6 |
(grub_cmd_parttool): Move show_help out of parent function.
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
---
|
|
|
a5bd9f6 |
ChangeLog | 5 +++
|
|
|
a5bd9f6 |
grub-core/commands/parttool.c | 90 ++++++++++++++++++++++---------------------
|
|
|
a5bd9f6 |
2 files changed, 51 insertions(+), 44 deletions(-)
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a5bd9f6 |
index 06123b6..df5f45b 100644
|
|
|
a5bd9f6 |
--- a/ChangeLog
|
|
|
a5bd9f6 |
+++ b/ChangeLog
|
|
|
a5bd9f6 |
@@ -1,5 +1,10 @@
|
|
|
a5bd9f6 |
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
+ * grub-core/commands/parttool.c (grub_cmd_parttool): Move show_help out
|
|
|
a5bd9f6 |
+ of parent function.
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
* util/grub-fstest.c: Remove nested functions.
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
2013-02-27 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c
|
|
|
a5bd9f6 |
index fadf873..0f9b651 100644
|
|
|
a5bd9f6 |
--- a/grub-core/commands/parttool.c
|
|
|
a5bd9f6 |
+++ b/grub-core/commands/parttool.c
|
|
|
a5bd9f6 |
@@ -95,6 +95,50 @@ grub_parttool_unregister (int handle)
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
static grub_err_t
|
|
|
a5bd9f6 |
+show_help (grub_device_t dev)
|
|
|
a5bd9f6 |
+{
|
|
|
a5bd9f6 |
+ int found = 0;
|
|
|
a5bd9f6 |
+ struct grub_parttool *cur;
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ for (cur = parts; cur; cur = cur->next)
|
|
|
a5bd9f6 |
+ if (grub_strcmp (dev->disk->partition->partmap->name, cur->name) == 0)
|
|
|
a5bd9f6 |
+ {
|
|
|
a5bd9f6 |
+ struct grub_parttool_argdesc *curarg;
|
|
|
a5bd9f6 |
+ found = 1;
|
|
|
a5bd9f6 |
+ for (curarg = cur->args; curarg->name; curarg++)
|
|
|
a5bd9f6 |
+ {
|
|
|
a5bd9f6 |
+ int spacing = 20;
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ spacing -= grub_strlen (curarg->name);
|
|
|
a5bd9f6 |
+ grub_printf ("%s", curarg->name);
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ switch (curarg->type)
|
|
|
a5bd9f6 |
+ {
|
|
|
a5bd9f6 |
+ case GRUB_PARTTOOL_ARG_BOOL:
|
|
|
a5bd9f6 |
+ grub_printf ("+/-");
|
|
|
a5bd9f6 |
+ spacing -= 3;
|
|
|
a5bd9f6 |
+ break;
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ case GRUB_PARTTOOL_ARG_VAL:
|
|
|
a5bd9f6 |
+ grub_xputs (_("=VAL"));
|
|
|
a5bd9f6 |
+ spacing -= 4;
|
|
|
a5bd9f6 |
+ break;
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ case GRUB_PARTTOOL_ARG_END:
|
|
|
a5bd9f6 |
+ break;
|
|
|
a5bd9f6 |
+ }
|
|
|
a5bd9f6 |
+ while (spacing-- > 0)
|
|
|
a5bd9f6 |
+ grub_printf (" ");
|
|
|
a5bd9f6 |
+ grub_puts_ (curarg->desc);
|
|
|
a5bd9f6 |
+ }
|
|
|
a5bd9f6 |
+ }
|
|
|
a5bd9f6 |
+ if (! found)
|
|
|
a5bd9f6 |
+ grub_printf_ (N_("Sorry no parttool is available for %s\n"),
|
|
|
a5bd9f6 |
+ dev->disk->partition->partmap->name);
|
|
|
a5bd9f6 |
+ return GRUB_ERR_NONE;
|
|
|
a5bd9f6 |
+}
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+static grub_err_t
|
|
|
a5bd9f6 |
grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|
|
a5bd9f6 |
int argc, char **args)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
@@ -104,48 +148,6 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|
|
a5bd9f6 |
int i, j;
|
|
|
a5bd9f6 |
grub_err_t err = GRUB_ERR_NONE;
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
- auto grub_err_t show_help (void);
|
|
|
a5bd9f6 |
- grub_err_t show_help (void)
|
|
|
a5bd9f6 |
- {
|
|
|
a5bd9f6 |
- int found = 0;
|
|
|
a5bd9f6 |
- for (cur = parts; cur; cur = cur->next)
|
|
|
a5bd9f6 |
- if (grub_strcmp (dev->disk->partition->partmap->name, cur->name) == 0)
|
|
|
a5bd9f6 |
- {
|
|
|
a5bd9f6 |
- struct grub_parttool_argdesc *curarg;
|
|
|
a5bd9f6 |
- found = 1;
|
|
|
a5bd9f6 |
- for (curarg = cur->args; curarg->name; curarg++)
|
|
|
a5bd9f6 |
- {
|
|
|
a5bd9f6 |
- int spacing = 20;
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
- spacing -= grub_strlen (curarg->name);
|
|
|
a5bd9f6 |
- grub_printf ("%s", curarg->name);
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
- switch (curarg->type)
|
|
|
a5bd9f6 |
- {
|
|
|
a5bd9f6 |
- case GRUB_PARTTOOL_ARG_BOOL:
|
|
|
a5bd9f6 |
- grub_printf ("+/-");
|
|
|
a5bd9f6 |
- spacing -= 3;
|
|
|
a5bd9f6 |
- break;
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
- case GRUB_PARTTOOL_ARG_VAL:
|
|
|
a5bd9f6 |
- grub_xputs (_("=VAL"));
|
|
|
a5bd9f6 |
- spacing -= 4;
|
|
|
a5bd9f6 |
- break;
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
- case GRUB_PARTTOOL_ARG_END:
|
|
|
a5bd9f6 |
- break;
|
|
|
a5bd9f6 |
- }
|
|
|
a5bd9f6 |
- while (spacing-- > 0)
|
|
|
a5bd9f6 |
- grub_printf (" ");
|
|
|
a5bd9f6 |
- grub_puts_ (curarg->desc);
|
|
|
a5bd9f6 |
- }
|
|
|
a5bd9f6 |
- }
|
|
|
a5bd9f6 |
- if (! found)
|
|
|
a5bd9f6 |
- grub_printf_ (N_("Sorry no parttool is available for %s\n"),
|
|
|
a5bd9f6 |
- dev->disk->partition->partmap->name);
|
|
|
a5bd9f6 |
- return GRUB_ERR_NONE;
|
|
|
a5bd9f6 |
- }
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
if (argc < 1)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
grub_puts_ (helpmsg);
|
|
|
a5bd9f6 |
@@ -241,11 +243,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
if (argc == 1)
|
|
|
a5bd9f6 |
- return show_help ();
|
|
|
a5bd9f6 |
+ return show_help (dev);
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
for (i = 1; i < argc; i++)
|
|
|
a5bd9f6 |
if (grub_strcmp (args[i], "help") == 0)
|
|
|
a5bd9f6 |
- return show_help ();
|
|
|
a5bd9f6 |
+ return show_help (dev);
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
parsed = (int *) grub_zalloc (argc * sizeof (int));
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
--
|
|
|
a5bd9f6 |
1.8.1.4
|
|
|
a5bd9f6 |
|