aboutsummaryrefslogtreecommitdiff
path: root/examples_library/datebox.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples_library/datebox.c')
-rw-r--r--examples_library/datebox.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/examples_library/datebox.c b/examples_library/datebox.c
index 4839c3dbd895..d2af7bd7fae0 100644
--- a/examples_library/datebox.c
+++ b/examples_library/datebox.c
@@ -28,24 +28,22 @@ int main()
mm = localtm->tm_mon + 1;
dd = localtm->tm_mday;
+ if (bsddialog_init() == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
+ }
+
bsddialog_initconf(&conf);
conf.title = "datebox";
conf.bottomtitle = "Press TAB and arrows";
-
- if (bsddialog_init() < 0)
- return -1;
-
output = bsddialog_datebox(&conf, "Example", 10, 50, &yy, &mm, &dd);
-
+
bsddialog_end();
switch (output) {
case BSDDIALOG_OK:
printf("Date: %u/%u/%u", yy, mm, dd);
break;
- case BSDDIALOG_ESC:
- printf("ESC\n");
- break;
case BSDDIALOG_CANCEL:
printf("Cancel");
break;
@@ -55,5 +53,5 @@ int main()
}
printf("\n");
- return output;
-}
+ return (output);
+} \ No newline at end of file