summaryrefslogtreecommitdiffstats
path: root/common/menutree.c
diff options
context:
space:
mode:
authorAleksey Kuleshov <rndfax@yandex.ru>2016-08-18 17:05:03 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2016-09-05 08:26:47 +0200
commitbf2abf90501858a97bf1e05024d963800312a5c4 (patch)
treeb60fe9ed29b48a16e3cfd65992aca9832d8a6491 /common/menutree.c
parentd0b8f4e0752fbe5e44fd9b2e6143ce80c0f5d4eb (diff)
downloadbarebox-bf2abf90501858a97bf1e05024d963800312a5c4.tar.gz
barebox-bf2abf90501858a97bf1e05024d963800312a5c4.tar.xz
rework menu so that it can support multiline titles
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/menutree.c')
-rw-r--r--common/menutree.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/menutree.c b/common/menutree.c
index eb14da0d01..400d1a6939 100644
--- a/common/menutree.c
+++ b/common/menutree.c
@@ -19,6 +19,7 @@
#include <shell.h>
#include <libfile.h>
+#include <linux/ctype.h>
#include <linux/stat.h>
struct menutree {
@@ -95,6 +96,7 @@ int menutree(const char *path, int toplevel)
glob_t g;
int i;
char *globpath, *display;
+ size_t size;
menu = menu_alloc();
@@ -106,14 +108,17 @@ int menutree(const char *path, int toplevel)
goto out;
}
- display = read_file_line("%s/title", path);
+ globpath = basprintf("%s/title", path);
+ display = read_file(globpath, &size);
+ free(globpath);
if (!display) {
eprintf("no title found in %s/title\n", path);
ret = -EINVAL;
goto out;
}
- menu->display = shell_expand(display);
+ strim(display);
+ menu_add_title(menu, shell_expand(display));
free(display);
for (i = 0; i < g.gl_pathc; i++) {