1 /*-
2 * SPDX-License-Identifier: CC0-1.0
3 *
4 * Written in 2021 by Alfonso Sabato Siciliano.
5 * To the extent possible under law, the author has dedicated all copyright
6 * and related and neighboring rights to this software to the public domain
7 * worldwide. This software is distributed without any warranty, see:
8 * <http://creativecommons.org/publicdomain/zero/1.0/>.
9 */
10
11 #include <bsddialog.h>
12 #include <stdio.h>
13
main()14 int main()
15 {
16 int output;
17 unsigned int sec;
18 struct bsddialog_conf conf;
19
20 if (bsddialog_init() == BSDDIALOG_ERROR) {
21 printf("Error: %s\n", bsddialog_geterror());
22 return (1);
23 }
24 bsddialog_initconf(&conf);
25 conf.title = "pause";
26 sec = 10;
27 output = bsddialog_pause(&conf, "Example", 8, 50, &sec);
28 bsddialog_end();
29
30 switch (output) {
31 case BSDDIALOG_ERROR:
32 printf("Error: %s\n", bsddialog_geterror());
33 return (1);
34 case BSDDIALOG_OK:
35 printf("[OK] remaining time: %u\n", sec);
36 break;
37 case BSDDIALOG_CANCEL:
38 printf("[Cancel] remaining time: %u\n", sec);
39 break;
40 case BSDDIALOG_TIMEOUT:
41 printf("Timeout\n");
42 break;
43 }
44
45 return (0);
46 }
47