On Thu, Sep 16, 2010 at 02:09:56PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > + } else { > > > + puts(" "); > > > + } > > > + printf(" %d: %-*s", me->num, m->width, me->display); > > > + } > > > > I think this could look a bit simpler if we had a > > static int printf_menu(int selected, const char *fmt, ...) function. > > 'selected' is a better name for the argument. with 'reverse' my first > > thought was that it prints backwards... > sorry I do not follow The print_menu_entry would look simpler like this: static void print_menu_entry(struct menu *m, struct menu_entry *me, int selected) { gotoXY(me->num + 1, 3); if (selected) printf("\e[7m"); if (me->type == MENU_ENTRY_BOX) { if (me->box_state) printf("[*]"); else printf("[ ]"); } else { printf(" "); } printf(" %d: %-*s", me->num, m->width, me->display); if (selected) printf("\e[m"); } I was confused by the name of the printf_reverse macro. For me it was not clear what it should do without looking at the macro definition. Regards, Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox