1 /*- 2 * SPDX-License-Identifier: CC0-1.0 3 * 4 * Written in 2025 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 <bsddialog.h> 12 #include <stdio.h> 13 14 int main() 15 { 16 int output; 17 unsigned long start, end, blocks[2][2]; 18 struct bsddialog_conf conf; 19 20 start = 20; 21 end = 70; 22 blocks[0][0] = 5; 23 blocks[0][1] = 10; 24 blocks[1][0] = 80; 25 blocks[1][1] = 90; 26 27 if (bsddialog_init() == BSDDIALOG_ERROR) { 28 printf("Error: %s\n", bsddialog_geterror()); 29 return (1); 30 } 31 bsddialog_initconf(&conf); 32 conf.title = "slider"; 33 34 output = bsddialog_slider(&conf, "Example", 0, 0, "GiB", 100, &start, 35 &end, false, 2, blocks); 36 bsddialog_end(); 37 if (output == BSDDIALOG_ERROR) { 38 printf("Error: %s\n", bsddialog_geterror()); 39 return (1); 40 } 41 printf("Start: %lu, End: %lu\n", start, end); 42 43 return (0); 44 } 45