xref: /freebsd/contrib/bsddialog/examples_library/rangebox.c (revision e92ffd9b626833ebdbf2742c8ffddc6cd94b963e)
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 value, output;
19 	struct bsddialog_conf conf;
20 
21 	bsddialog_initconf(&conf);
22 	conf.title = "rangebox";
23 
24 	if (bsddialog_init() < 0)
25 		return -1;
26 
27 	value = 5;
28 	output = bsddialog_rangebox(&conf, "Example", 8, 50, 0, 10, &value);
29 
30 	bsddialog_end();
31 
32 	printf("Value: %d", value);
33 
34 	return output;
35 }
36