diff options
Diffstat (limited to 'contrib/bsddialog/examples_library/msgbox.c')
-rw-r--r-- | contrib/bsddialog/examples_library/msgbox.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/contrib/bsddialog/examples_library/msgbox.c b/contrib/bsddialog/examples_library/msgbox.c index 487266745c65..988e2976ee8e 100644 --- a/contrib/bsddialog/examples_library/msgbox.c +++ b/contrib/bsddialog/examples_library/msgbox.c @@ -8,35 +8,31 @@ * <http://creativecommons.org/publicdomain/zero/1.0/>. */ -#include <stdio.h> -#include <string.h> - #include <bsddialog.h> +#include <stdio.h> int main() { - int input; + int output; struct bsddialog_conf conf; - /* Configuration */ - bsddialog_initconf(&conf); - conf.title = "msgbox"; - - /* Run BSDDialog */ if (bsddialog_init() == BSDDIALOG_ERROR) { printf("Error: %s\n", bsddialog_geterror()); - return -1; + return (1); } - input = bsddialog_msgbox(&conf, "Example", 7, 20); + bsddialog_initconf(&conf); + conf.title = "msgbox"; + output = bsddialog_msgbox(&conf, "Example", 7, 20); bsddialog_end(); - /* User Input */ - printf("User input: "); - switch (input) { - case BSDDIALOG_ERROR: printf("Error %s\n", bsddialog_geterror()); break; - case BSDDIALOG_OK: printf("OK\n"); break; - case BSDDIALOG_ESC: printf("ESC\n"); break; + switch (output) { + case BSDDIALOG_ERROR: + printf("Error %s\n", bsddialog_geterror()); + return (1); + case BSDDIALOG_OK: + printf("[OK]\n"); + break; } - return input; -} + return (0); +}
\ No newline at end of file |