aboutsummaryrefslogtreecommitdiff
path: root/contrib/bsddialog/examples_library/datebox.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bsddialog/examples_library/datebox.c')
-rw-r--r--contrib/bsddialog/examples_library/datebox.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/contrib/bsddialog/examples_library/datebox.c b/contrib/bsddialog/examples_library/datebox.c
index a3c8946b7f79..e0741319d388 100644
--- a/contrib/bsddialog/examples_library/datebox.c
+++ b/contrib/bsddialog/examples_library/datebox.c
@@ -10,7 +10,6 @@
#include <bsddialog.h>
#include <stdio.h>
-#include <string.h>
#include <time.h>
int main()
@@ -31,27 +30,15 @@ int main()
printf("Error: %s\n", bsddialog_geterror());
return (1);
}
-
bsddialog_initconf(&conf);
conf.title = "datebox";
- output = bsddialog_datebox(&conf,
- "TAB / RIGHT / LEFT to move,\nUP / DOWN to select time", 10, 35,
- &yy, &mm, &dd);
-
+ output = bsddialog_datebox(&conf, "Example", 9, 35, &yy, &mm, &dd);
bsddialog_end();
-
- switch (output) {
- case BSDDIALOG_OK:
- printf("Date: %u/%u/%u", yy, mm, dd);
- break;
- case BSDDIALOG_CANCEL:
- printf("Cancel");
- break;
- case BSDDIALOG_ERROR:
- printf("Error: %s", bsddialog_geterror());
- break;
+ if (output == BSDDIALOG_ERROR) {
+ printf("Error: %s\n", bsddialog_geterror());
+ return (1);
}
- printf("\n");
+ printf("Date: %u/%u/%u\n", yy, mm, dd);
- return (output);
+ return (0);
} \ No newline at end of file