[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] make assumed terminal width on cmd help dynamic
From: |
Marco Gerards |
Subject: |
Re: [PATCH] make assumed terminal width on cmd help dynamic |
Date: |
Sun, 20 Jul 2008 21:41:59 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
"Felix Zielcke" <address@hidden> writes:
> From: "Marco Gerards" <address@hidden>
>
>>
>> It would be better to replace all users of TERM_WIDTH to use
>> GRUB_TERM_WIDTH, like you mentioned. Only ugly thing is that this is
>> actually a function...
>>
>
> Here it is.
>
>
> Felix Zielcke <address@hidden>
>
>
> * commands/help.c: Include <grub/term.h>.
> (TERM_WIDTH): Removed. Updated all uses.
I would say "Updated all users." or perhaps even "Updated all
callers.". English is not my native language, hopefully someone can
help us out ;-).
If this is updated, this patch can be applied as far as I am concerned :-)
> Index: commands/help.c
> ===================================================================
> --- commands/help.c (Revision 1723)
> +++ commands/help.c (Arbeitskopie)
> @@ -21,11 +21,8 @@
> #include <grub/dl.h>
> #include <grub/arg.h>
> #include <grub/misc.h>
> +#include <grub/term.h>
>
> -/* XXX: This has to be changed into a function so the screen can be
> - optimally used. */
> -#define TERM_WIDTH 80
> -
> static grub_err_t
> grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,
> char **args)
> @@ -43,16 +40,16 @@
> {
> if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
> {
> - char description[TERM_WIDTH / 2];
> + char description[GRUB_TERM_WIDTH / 2];
> int desclen = grub_strlen (cmd->summary);
>
> - /* Make a string with a length of TERM_WIDTH / 2 - 1 filled
> + /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
> with the description followed by spaces. */
> - grub_memset (description, ' ', TERM_WIDTH / 2 - 1);
> - description[TERM_WIDTH / 2 - 1] = '\0';
> + grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
> + description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
> grub_memcpy (description, cmd->summary,
> - (desclen < TERM_WIDTH / 2 - 1
> - ? desclen : TERM_WIDTH / 2 - 1));
> + (desclen < GRUB_TERM_WIDTH / 2 - 1
> + ? desclen : GRUB_TERM_WIDTH / 2 - 1));
>
> grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
> }
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel