Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KKe1N-0003dn-AV for mharc-grub-devel@gnu.org; Sun, 20 Jul 2008 14:52:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KKe1L-0003dT-T1 for grub-devel@gnu.org; Sun, 20 Jul 2008 14:52:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KKe1I-0003cF-EF for grub-devel@gnu.org; Sun, 20 Jul 2008 14:52:35 -0400 Received: from [199.232.76.173] (port=36654 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKe1I-0003cC-8P for grub-devel@gnu.org; Sun, 20 Jul 2008 14:52:32 -0400 Received: from moutng.kundenserver.de ([212.227.126.188]:51362) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KKe1H-0003Lz-RD for grub-devel@gnu.org; Sun, 20 Jul 2008 14:52:32 -0400 Received: from fz (e180026197.adsl.alicedsl.de [85.180.26.197]) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis) id 0MKwtQ-1KKe1G2vsF-0000tO; Sun, 20 Jul 2008 20:52:30 +0200 Message-ID: <4BD4DF5CD2064035AC9DF15E29133A2D@fz> From: "Felix Zielcke" To: "The development of GRUB 2" References: <89CD688385DC46C0B8A1049A6C2B14F4@fz> <873am4ju9t.fsf@xs4all.nl> Date: Sun, 20 Jul 2008 20:52:13 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 12.0.1606 X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606 X-Provags-ID: V01U2FsdGVkX18IPOZpJOH+20BHw/Dlxvtuqdf+JgG5W2cDk8a TrNhtGCMRUl1vcUKs9h/5GAqa1zv2JCj8lczPEehHhwgpfhniB l+bJW5TtiTfHj1AxbXmjb6LbnbkyRxk X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Subject: Re: [PATCH] make assumed terminal width on cmd help dynamic X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2008 18:52:36 -0000 From: "Marco Gerards" > > 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 * commands/help.c: Include . (TERM_WIDTH): Removed. Updated all uses. Index: commands/help.c =================================================================== --- commands/help.c (Revision 1723) +++ commands/help.c (Arbeitskopie) @@ -21,11 +21,8 @@ #include #include #include +#include -/* 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" : " "); }