1f499134dSBaptiste Daroussin /*-
2f499134dSBaptiste Daroussin * SPDX-License-Identifier: CC0-1.0
3f499134dSBaptiste Daroussin *
4f499134dSBaptiste Daroussin * Written in 2021 by Alfonso Sabato Siciliano.
5f499134dSBaptiste Daroussin * To the extent possible under law, the author has dedicated all copyright
6f499134dSBaptiste Daroussin * and related and neighboring rights to this software to the public domain
7f499134dSBaptiste Daroussin * worldwide. This software is distributed without any warranty, see:
8f499134dSBaptiste Daroussin * <http://creativecommons.org/publicdomain/zero/1.0/>.
9f499134dSBaptiste Daroussin */
10f499134dSBaptiste Daroussin
11bce40c02SAlfonso S. Siciliano #include <bsddialog.h>
12f499134dSBaptiste Daroussin #include <stdio.h>
13f499134dSBaptiste Daroussin
main()14f499134dSBaptiste Daroussin int main()
15f499134dSBaptiste Daroussin {
16f499134dSBaptiste Daroussin int i, output;
17f499134dSBaptiste Daroussin struct bsddialog_conf conf;
18f499134dSBaptiste Daroussin struct bsddialog_menuitem items[5] = {
19263660c0SAlfonso Siciliano {"I", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},
20263660c0SAlfonso Siciliano {"II", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},
21263660c0SAlfonso Siciliano {"III", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},
22263660c0SAlfonso Siciliano {"IV", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},
23263660c0SAlfonso Siciliano {"V", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}
24f499134dSBaptiste Daroussin };
25f499134dSBaptiste Daroussin
26263660c0SAlfonso Siciliano if (bsddialog_init() == BSDDIALOG_ERROR) {
27263660c0SAlfonso Siciliano printf("Error: %s\n", bsddialog_geterror());
28263660c0SAlfonso Siciliano return (1);
29263660c0SAlfonso Siciliano }
30f499134dSBaptiste Daroussin bsddialog_initconf(&conf);
31f499134dSBaptiste Daroussin conf.title = "menu";
32f499134dSBaptiste Daroussin output = bsddialog_menu(&conf, "Example", 15, 30, 5, 5, items, NULL);
33f499134dSBaptiste Daroussin bsddialog_end();
34263660c0SAlfonso Siciliano if (output == BSDDIALOG_ERROR) {
35263660c0SAlfonso Siciliano printf("Error: %s\n", bsddialog_geterror());
36263660c0SAlfonso Siciliano return (1);
37263660c0SAlfonso Siciliano }
38263660c0SAlfonso Siciliano
39f499134dSBaptiste Daroussin printf("Menu:\n");
40f499134dSBaptiste Daroussin for (i = 0; i < 5; i++)
41f499134dSBaptiste Daroussin printf(" [%c] %s\n", items[i].on ? 'X' : ' ', items[i].name);
42f499134dSBaptiste Daroussin
43*61ba55bcSBaptiste Daroussin return (0);
44f499134dSBaptiste Daroussin }