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 <stdio.h> 12 #include <string.h> 13 14 #include <bsddialog.h> 15 16 int main() 17 { 18 int output; 19 struct bsddialog_conf conf; 20 21 bsddialog_initconf(&conf); 22 conf.title = "pause"; 23 24 if (bsddialog_init() < 0) 25 return -1; 26 27 output = bsddialog_pause(&conf, "Example", 8, 50, 10); 28 29 bsddialog_end(); 30 31 switch (output) { 32 case BSDDIALOG_OK: 33 printf("OK\n"); 34 break; 35 case BSDDIALOG_ESC: 36 printf("ESC\n"); 37 break; 38 case BSDDIALOG_CANCEL: 39 printf("Cancel\n"); 40 break; 41 case BSDDIALOG_ERROR: 42 printf("Error: %s\n", bsddialog_geterror()); 43 break; 44 case BSDDIALOG_TIMEOUT: 45 printf("Timeout\n"); 46 break; 47 } 48 49 return output; 50 } 51