Path: blob/main/contrib/bsddialog/examples_library/pause.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;16unsigned int sec;17struct bsddialog_conf conf;1819if (bsddialog_init() == BSDDIALOG_ERROR) {20printf("Error: %s\n", bsddialog_geterror());21return (1);22}23bsddialog_initconf(&conf);24conf.title = "pause";25sec = 10;26output = bsddialog_pause(&conf, "Example", 8, 50, &sec);27bsddialog_end();2829switch (output) {30case BSDDIALOG_ERROR:31printf("Error: %s\n", bsddialog_geterror());32return (1);33case BSDDIALOG_OK:34printf("[OK] remaining time: %u\n", sec);35break;36case BSDDIALOG_CANCEL:37printf("[Cancel] remaining time: %u\n", sec);38break;39case BSDDIALOG_TIMEOUT:40printf("Timeout\n");41break;42}4344return (0);45}464748