summaryrefslogtreecommitdiff
path: root/examples_library/checklist.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples_library/checklist.c')
-rw-r--r--examples_library/checklist.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/examples_library/checklist.c b/examples_library/checklist.c
index d1c4a4db3597..7851383d0553 100644
--- a/examples_library/checklist.c
+++ b/examples_library/checklist.c
@@ -18,27 +18,38 @@ int main()
int i, output;
struct bsddialog_conf conf;
struct bsddialog_menuitem items[5] = {
- {"", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},
- {"", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},
- {"", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},
- {"", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},
- {"", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}
+ {"i", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},
+ {"ii", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},
+ {"iii", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},
+ {"iv", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},
+ {"v", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}
};
+ if (bsddialog_init() == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
bsddialog_initconf(&conf);
conf.title = "checklist";
-
- if (bsddialog_init() < 0)
- return -1;
-
- output = bsddialog_checklist(&conf, "Example", 15, 30, 5, 5, items, NULL);
+ output = bsddialog_checklist(&conf, "Example", 15, 30, 5, 5, items,
+ NULL);
bsddialog_end();
+ if (output == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
+ if (output == BSDDIALOG_CANCEL) {
+ printf("Cancel\n");
+ return (0);
+ }
+
printf("Checklist:\n");
- for (i=0; i<5; i++)
+ for (i = 0; i < 5; i++)
printf(" [%c] %s\n", items[i].on ? 'X' : ' ', items[i].name);
-
-
- return output;
-}
+
+ return (output);
+} \ No newline at end of file