Path: blob/main/contrib/bsddialog/examples_library/yesno.c
39476 views
/*-1* SPDX-License-Identifier: CC0-1.02*3* Written in 2021 by Alfonso Sabato Siciliano.4* To the extent possible under law, the author has dedicated all copyright5* and related and neighboring rights to this software to the public domain6* worldwide. This software is distributed without any warranty, see:7* <http://creativecommons.org/publicdomain/zero/1.0/>.8*/910#include <bsddialog.h>11#include <stdio.h>1213int main()14{15int output;16struct bsddialog_conf conf;1718if (bsddialog_init() == BSDDIALOG_ERROR) {19printf("Error: %s\n", bsddialog_geterror());20return (1);21}22bsddialog_initconf(&conf);23conf.title = "yesno";24output = bsddialog_yesno(&conf, "Example", 7, 25);25bsddialog_end();2627switch (output) {28case BSDDIALOG_ERROR:29printf("Error %s\n", bsddialog_geterror());30return (1);31case BSDDIALOG_YES:32printf("[YES]\n");33break;34case BSDDIALOG_NO:35printf("[NO]\n");36break;37}3839return (0);40}4142