* grub-core/lib/arg.c (grub_arg_show_help): Move showargs

out of its parent.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-02-28 11:00:59 +01:00
parent 4fc40ff8f3
commit ff2b3cd928
2 changed files with 60 additions and 54 deletions

View file

@ -1,3 +1,8 @@
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/arg.c (grub_arg_show_help): Move showargs
out of its parent.
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com> 2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/jfs.c: Remove nested functions. * grub-core/fs/jfs.c: Remove nested functions.

View file

@ -109,14 +109,9 @@ show_usage (grub_extcmd_t cmd)
grub_printf ("%s %s %s\n", _("Usage:"), cmd->cmd->name, _(cmd->cmd->summary)); grub_printf ("%s %s %s\n", _("Usage:"), cmd->cmd->name, _(cmd->cmd->summary));
} }
void static void
grub_arg_show_help (grub_extcmd_t cmd) showargs (const struct grub_arg_option *opt,
{ int h_is_used, int u_is_used)
auto void showargs (const struct grub_arg_option *opt);
int h_is_used = 0;
int u_is_used = 0;
auto void showargs (const struct grub_arg_option *opt)
{ {
for (; opt->doc; opt++) for (; opt->doc; opt++)
{ {
@ -150,7 +145,20 @@ grub_arg_show_help (grub_extcmd_t cmd)
grub_xputs (" "); grub_xputs (" ");
grub_printf ("%s\n", _(opt->doc)); grub_printf ("%s\n", _(opt->doc));
}
}
void
grub_arg_show_help (grub_extcmd_t cmd)
{
int h_is_used = 0;
int u_is_used = 0;
const struct grub_arg_option *opt;
show_usage (cmd);
grub_printf ("%s\n\n", _(cmd->cmd->description));
for (opt = cmd->options; opt->doc; opt++)
switch (opt->shortarg) switch (opt->shortarg)
{ {
case 'h': case 'h':
@ -160,18 +168,11 @@ grub_arg_show_help (grub_extcmd_t cmd)
case 'u': case 'u':
u_is_used = 1; u_is_used = 1;
break; break;
default:
break;
}
}
} }
show_usage (cmd);
grub_printf ("%s\n\n", _(cmd->cmd->description));
if (cmd->options) if (cmd->options)
showargs (cmd->options); showargs (cmd->options, h_is_used, u_is_used);
showargs (help_options); showargs (help_options, h_is_used, u_is_used);
#if 0 #if 0
grub_printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); grub_printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT);
#endif #endif