aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfonso S. Siciliano <asiciliano@FreeBSD.org>2024-05-27 17:51:37 +0000
committerAlfonso S. Siciliano <asiciliano@FreeBSD.org>2024-05-27 17:51:37 +0000
commit813f3dc7b302324a361326c2583f37b002100968 (patch)
treebb5710cef1c722a7997f3d20d7b5e4125179fd77
parentbe8846bd9e069f4a6bea3d769005bea96cf43990 (diff)
downloadsrc-vendor/bsddialog.tar.gz
src-vendor/bsddialog.zip
contrib/bsddialog: Import version 1.0.3vendor/bsddialog/1.0.3vendor/bsddialog
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
-rw-r--r--CHANGELOG9
-rw-r--r--Makefile2
-rw-r--r--README.md4
-rw-r--r--lib/bsddialog.h2
-rw-r--r--utility/bsddialog.17
-rw-r--r--utility/util_builders.c7
6 files changed, 26 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0e75f847347d..6877297d4358 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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:
diff --git a/Makefile b/Makefile
index e6ec9988c59d..f1b2da675f9e 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index a902f7fada7a..f984b488b232 100644
--- a/README.md
+++ b/README.md
@@ -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.
+
diff --git a/lib/bsddialog.h b/lib/bsddialog.h
index 08fb25b8701c..c797f918fb89 100644
--- a/lib/bsddialog.h
+++ b/lib/bsddialog.h
@@ -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
diff --git a/utility/bsddialog.1 b/utility/bsddialog.1
index fac17ef114b4..4586ba16020c 100644
--- a/utility/bsddialog.1
+++ b/utility/bsddialog.1
@@ -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
diff --git a/utility/util_builders.c b/utility/util_builders.c
index 8c846819f4ee..2e69994a0ec0 100644
--- a/utility/util_builders.c
+++ b/utility/util_builders.c
@@ -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);