Path: blob/main/contrib/bsddialog/examples_library/slider.c
96290 views
/*-1* SPDX-License-Identifier: CC0-1.02*3* Written in 2025 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 long start, end, blocks[2][2];17struct bsddialog_conf conf;1819start = 20;20end = 70;21blocks[0][0] = 5;22blocks[0][1] = 10;23blocks[1][0] = 80;24blocks[1][1] = 90;2526if (bsddialog_init() == BSDDIALOG_ERROR) {27printf("Error: %s\n", bsddialog_geterror());28return (1);29}30bsddialog_initconf(&conf);31conf.title = "slider";3233output = bsddialog_slider(&conf, "Example", 0, 0, "GiB", 100, &start,34&end, false, 2, blocks);35bsddialog_end();36if (output == BSDDIALOG_ERROR) {37printf("Error: %s\n", bsddialog_geterror());38return (1);39}40printf("Start: %lu, End: %lu\n", start, end);4142return (0);43}444546