contrib/bsddialog: Import version 1.0.3

Change --mixedform output to adapt to bsdinstall restoring dialog(1)
behavior.

Avoid to print the field value to output if <fieldlen> is read-only
(less than or equal to zero). This fixes passwords in wlanconfig,
avoiding to print also SSID.

To note --mixedform continues to print field value if <flag> is
read-only. This avoids breaking netconfig and netconfig_ipv6.

See /usr/src/contrib/bsddialog/CHANGELOG '2024-05-27 Version 1.0.3'
for more detailed information.

Reported by:	garga
This commit is contained in:
Alfonso S. Siciliano 2024-05-27 19:51:37 +02:00
parent be8846bd9e
commit 813f3dc7b3
No known key found for this signature in database
GPG Key ID: 3F9EEFACFD371E37
6 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2024-05-27 1.0.3
Utility:
change: --form and --mixedform do not print field value to output fd if
<fieldlen> is <= 0 (readonly). To note --mixedgauge continues
to print field value if <flag> = 2 (readonly) unless <fieldlen>
is <= 0 (as described previously).
2024-04-11 Version 1.0.2
Utility:

View File

@ -4,7 +4,7 @@
# Written in 2023 by Alfonso Sabato Siciliano
OUTPUT = bsddialog
export VERSION=1.0.2
export VERSION=1.0.3
.CURDIR ?= ${CURDIR}
LIBPATH = ${.CURDIR}/lib
LIBBSDDIALOG = ${LIBPATH}/libbsddialog.so

View File

@ -1,4 +1,4 @@
# BSDDialog 1.0.2
# BSDDialog 1.0.3
This project provides **bsddialog** and **libbsddialog**, an utility
and a library to build scripts and tools with TUI dialogs and widgets.
@ -138,3 +138,5 @@ in the _Public Domain_ to build new projects:
- fix --form "" 0 0 0 Label 1 0 Init 1 12 0 0 (with 0 editable field).
- fix --mixedform "" 0 0 0 Label 1 0 Init 1 12 0 0 2 (with 0 editable field).
- add *text* customization to --hmsg *help-message*
- check --passwordform *fieldlen* like --form and --mixedform.

View File

@ -30,7 +30,7 @@
#include <stdbool.h>
#define LIBBSDDIALOG_VERSION "1.0.2"
#define LIBBSDDIALOG_VERSION "1.0.3"
/* Return values */
#define BSDDIALOG_ERROR -1

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd April 7, 2024
.Dd May 25, 2024
.Dt BSDDIALOG 1
.Os
.Sh NAME
@ -495,6 +495,7 @@ if
the field becomes readonly and its value is the
.Ar init
width.
The field input is not printed to output if it is readonly.
.Ar maxletters
is the maximum input length, if is
.Dv 0
@ -553,6 +554,10 @@ if
the field becomes readonly and its value is the
.Ar init
width.
The field input is not printed to output if
.Ar fieldlen
is less than or equal to
.Dv 0 .
.Ar maxletters
is the maximum input length, if is
.Dv 0

View File

@ -581,7 +581,8 @@ print_form_items(int output, int nitems, struct bsddialog_formitem *items,
}
for (i = 0; i < nitems; i++) {
dprintf(opt->output_fd, "%s\n", items[i].value);
if (!(items[i].flags & BSDDIALOG_FIELDREADONLY))
dprintf(opt->output_fd, "%s\n", items[i].value);
free(items[i].value);
}
}
@ -715,6 +716,10 @@ int mixedform_builder(BUILDER_ARGS)
focusitem = -1;
output = bsddialog_form(conf, text, rows, cols, formheight, nitems,
items, &focusitem);
for (i = 0; i < nitems; i++) {
if ((int)strtol(argv[i * sizeitem + 6], NULL, 10) > 0)
items[i].flags &= ~ BSDDIALOG_FIELDREADONLY;
}
print_form_items(output, nitems, items, focusitem, opt);
free(items);