2 * SPDX-License-Identifier: CC0-1.0
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/>.
11 #include <bsddialog.h>
16 #define H BSDDIALOG_FIELDHIDDEN
17 #define RO BSDDIALOG_FIELDREADONLY
22 struct bsddialog_conf conf;
23 struct bsddialog_formitem items[3] = {
24 {"Input:", 0, 0, "value", 0, 10, 30, 50, NULL, 0, "desc 1"},
25 {"Input:", 1, 0, "read only", 1, 10, 30, 50, NULL, RO, "desc 2"},
26 {"Password:", 2, 0, "", 2, 10, 30, 50, NULL, H, "desc 3"}
29 /* Optional, unless for unicode/multi-column characters */
30 setlocale(LC_ALL, "");
32 if (bsddialog_init() == BSDDIALOG_ERROR) {
33 printf("Error: %s\n", bsddialog_geterror());
36 bsddialog_initconf(&conf);
38 conf.form.securech = '*';
39 output = bsddialog_form(&conf, "Example", 10, 50, 3, 3, items, NULL);
41 if (output == BSDDIALOG_ERROR) {
42 printf("Error: %s", bsddialog_geterror());
46 for (i = 0; i < 3; i++) {
47 printf("%s \"%s\"\n", items[i].label, items[i].value);