]> git.ozlabs.org Git - petitboot/commit
ui/ncurses: Ensure boot option labels are displayable as menu items
authorJeremy Kerr <jk@ozlabs.org>
Thu, 13 Mar 2014 07:18:04 +0000 (15:18 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 10 Apr 2014 03:18:26 +0000 (11:18 +0800)
commitada4ea46dd44e667bfe6341e0b7b5366e5741351
tree99359c98216639782deb2623c6a9ed8f6d4808d7
parent6c7cf0a58b0e4be046b2367c93925e1c4895dd6c
ui/ncurses: Ensure boot option labels are displayable as menu items

ncurses' new_item() expects the name parameter to be a "printable
string", by converting it to a wchar *, and checking that each character
is printable with iswprint(). If it fails, we won't see a boot option at
all.

This change introduces a function to convert the label into something we
know is printable, and valid UTF-8. If mbstowcs fails, we replace it
with a generic 'Invalid option' label. If we encounter a valid multibyte
string with unprintable characters, we replace those with U+fffd
REPLACEMENT CHARACTER.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-menu.c