Michael Brown <[email protected]> on Tue, 2012/07/03 16:24:
> On Tuesday 03 Jul 2012 15:29:36 Christian Hesse wrote:
> > > > Applied, with some modifications:
> > > >   http://git.ipxe.org/ipxe.git/commitdiff/b3adabd
> > > > 
> > > > Thanks, and sorry for the delay.
> > > 
> > > Sorry, but this does not work... MENU_COLS + 1 is too much, the string
> > > is truncated but it is still not shown as it is one byte too long.
> > > 
> > > I would suggest the attached patch, this leaves a blank left and right
> > > of the menu title.
> > > This is like menu items behave, they always have a blank at the end as
> > > well.
> > 
> > Stupid me... Please ignore my last patch.
> > The attached one should be correct. We should not count the null byte.
> 
> strlen() returns the length of a string excluding the terminating NUL.

You are right... But sizeof() returns 81 (MENU_COLS + 1) in this case.
So how about this?
-- 
main(a,b){char*/*    Schoene Gruesse                         */c="B?IJj;M"
"EHCX:;";for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index e925009..94aceb9 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -349,7 +349,7 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
 
 	/* Draw initial content */
 	attron ( A_BOLD );
-	snprintf ( buf, sizeof ( buf ), "%s", ui.menu->title );
+	snprintf ( buf, MENU_COLS, "%s", ui.menu->title );
 	mvprintw ( TITLE_ROW, ( ( COLS - strlen ( buf ) ) / 2 ), "%s", buf );
 	attroff ( A_BOLD );
 	draw_menu_items ( &ui );
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel

Reply via email to