diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-09-17 12:06:49 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-10-02 15:05:24 +0200 |
commit | ec75a254d29aa0beec6ab8c3cf7745bc38ea8ded (patch) | |
tree | 83f3828efac911b1427ac0eb8eac47ee4d1a6fb8 /src/firstboot | |
parent | Merge pull request #34616 from DaanDeMeyer/mkosi (diff) | |
download | systemd-ec75a254d29aa0beec6ab8c3cf7745bc38ea8ded.tar.xz systemd-ec75a254d29aa0beec6ab8c3cf7745bc38ea8ded.zip |
Move show_menu() to terminal-util.h
Diffstat (limited to 'src/firstboot')
-rw-r--r-- | src/firstboot/firstboot.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 236c64634c..3bf11e7f21 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -132,52 +132,6 @@ static void print_welcome(int rfd) { done = true; } -static int show_menu(char **x, unsigned n_columns, unsigned width, unsigned percentage) { - unsigned break_lines, break_modulo; - size_t n, per_column, i, j; - - assert(n_columns > 0); - - n = strv_length(x); - per_column = DIV_ROUND_UP(n, n_columns); - - break_lines = lines(); - if (break_lines > 2) - break_lines--; - - /* The first page gets two extra lines, since we want to show - * a title */ - break_modulo = break_lines; - if (break_modulo > 3) - break_modulo -= 3; - - for (i = 0; i < per_column; i++) { - - for (j = 0; j < n_columns; j++) { - _cleanup_free_ char *e = NULL; - - if (j * per_column + i >= n) - break; - - e = ellipsize(x[j * per_column + i], width, percentage); - if (!e) - return log_oom(); - - printf("%4zu) %-*s", j * per_column + i + 1, (int) width, e); - } - - putchar('\n'); - - /* on the first screen we reserve 2 extra lines for the title */ - if (i % break_lines == break_modulo) { - if (!any_key_to_proceed()) - return 0; - } - } - - return 0; -} - static int prompt_loop(const char *text, char **l, unsigned percentage, bool (*is_valid)(const char *name), char **ret) { int r; |