git: 8df9efe877ec - main - bsdinstall: Fix command line argument list parsing

From: Alfonso S. Siciliano <asiciliano_at_FreeBSD.org>
Date: Wed, 11 Oct 2023 08:20:52 UTC
The branch main has been updated by asiciliano:

URL: https://cgit.FreeBSD.org/src/commit/?id=8df9efe877eced9364dedaf804b06731ab502bb7

commit 8df9efe877eced9364dedaf804b06731ab502bb7
Author:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
AuthorDate: 2023-10-11 08:17:04 +0000
Commit:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
CommitDate: 2023-10-11 08:17:04 +0000

    bsdinstall: Fix command line argument list parsing
    
    bsddialog(1) uses getopt_long(3) to parse command line argument list.
    Add '--' to avoid errors caused by arguments (menu items) begin
    with '-'.
    The change is compatible with dialog(1) and Xdialog(1).
---
 usr.sbin/bsdinstall/scripts/keymap  | 2 +-
 usr.sbin/bsdinstall/scripts/zfsboot | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/keymap b/usr.sbin/bsdinstall/scripts/keymap
index 63f1f2455096..6f4060c0772e 100755
--- a/usr.sbin/bsdinstall/scripts/keymap
+++ b/usr.sbin/bsdinstall/scripts/keymap
@@ -195,7 +195,7 @@ while :; do
 		--default-item \"\$defaultitem\"   \
 		--menu \"\$prompt\"                \
 		$height $width $rows               \
-		$menu_list                         \
+		${USE_DIALOG:+--} $menu_list       \
 		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
 	) || {
 		f_quietly rm -f "$KEYMAPFILE"
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index a671841b15e5..619d11c56000 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -396,7 +396,7 @@ dialog_menu_main()
 		--default-item \"\$defaultitem\" \
 		--menu \"\$prompt\"              \
 		$height $width $rows             \
-		$menu_list                       \
+		${USE_DIALOG:+--} $menu_list     \
 		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
 	)
 	local retval=$?