aboutsummaryrefslogtreecommitdiff
path: root/examples_library/yesno.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples_library/yesno.c')
-rw-r--r--examples_library/yesno.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/examples_library/yesno.c b/examples_library/yesno.c
index 783fcf57cbb6..5a9c95edc849 100644
--- a/examples_library/yesno.c
+++ b/examples_library/yesno.c
@@ -18,15 +18,28 @@ int main()
int output;
struct bsddialog_conf conf;
+ if (bsddialog_init() == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
bsddialog_initconf(&conf);
conf.title = "yesno";
-
- if (bsddialog_init() < 0)
- return -1;
-
output = bsddialog_yesno(&conf, "Example", 7, 25);
bsddialog_end();
- return output;
-}
+ switch (output) {
+ case BSDDIALOG_ERROR:
+ printf("Error %s\n", bsddialog_geterror());
+ break;
+ case BSDDIALOG_YES:
+ printf("YES\n");
+ break;
+ case BSDDIALOG_NO:
+ printf("NO\n");
+ break;
+ }
+
+ return (output);
+} \ No newline at end of file