aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfonso S. Siciliano <asiciliano@FreeBSD.org>2023-10-23 14:11:54 +0000
committerAlfonso S. Siciliano <asiciliano@FreeBSD.org>2023-10-23 14:11:54 +0000
commitc36b3dbc99d1e6dfc658e9c20382abc75749af82 (patch)
treee6cb561c669cd9ac55b7031949938d00ed622493
parent0f8b2ba6c629237e4ddd7a72f7c22f687208060d (diff)
bsdconfig: Restore bsddialog
Readd bsddialog(1) to bsdconfig(8). This can be considered an increment not a replacement: `$DIALOG=dialog' restores dialog(1), no change for Xdialog(1). An exception is if an error occurs, bsddialog(1) replaces dialog.
-rw-r--r--usr.sbin/bsdconfig/share/common.subr10
-rw-r--r--usr.sbin/bsdconfig/share/dialog.subr17
2 files changed, 18 insertions, 9 deletions
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr
index ba4d4fce4abb..830279168ff2 100644
--- a/usr.sbin/bsdconfig/share/common.subr
+++ b/usr.sbin/bsdconfig/share/common.subr
@@ -369,7 +369,7 @@ f_show_info()
if f_have f_dialog_info; then
f_dialog_info "$msg"
else
- dialog --infobox "$msg" 0 0
+ bsddialog --infobox "$msg" 0 0
fi
}
@@ -390,7 +390,7 @@ f_show_msg()
if f_have f_dialog_msgbox; then
f_dialog_msgbox "$msg"
else
- dialog --msgbox "$msg" 0 0
+ bsddialog --msgbox "$msg" 0 0
fi
}
@@ -433,7 +433,7 @@ f_yesno()
if f_have f_dialog_yesno; then
f_dialog_yesno "$msg"
else
- dialog --yesno "$msg" 0 0
+ bsddialog --yesno "$msg" 0 0
fi
}
@@ -455,7 +455,7 @@ f_noyes()
if f_have f_dialog_noyes; then
f_dialog_noyes "$msg"
else
- dialog --defaultno --yesno "$msg" 0 0
+ bsddialog --defaultno --yesno "$msg" 0 0
fi
}
@@ -486,7 +486,7 @@ f_show_help()
if f_have f_dialog_textbox; then
f_dialog_textbox "$file"
else
- dialog --msgbox "$( cat "$file" 2>&1 )" 0 0
+ bsddialog --msgbox "$( cat "$file" 2>&1 )" 0 0
fi
}
diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr
index 5b7ae9123073..cac0a3e24e53 100644
--- a/usr.sbin/bsdconfig/share/dialog.subr
+++ b/usr.sbin/bsdconfig/share/dialog.subr
@@ -51,7 +51,7 @@ f_include_lang $BSDCFG_LIBE/include/messages.subr
# Default name of dialog(1) utility
# NOTE: This is changed to "Xdialog" by the optional `-X' argument
#
-DIALOG="dialog"
+DIALOG="bsddialog"
#
# Default dialog(1) title and backtitle text
@@ -84,6 +84,15 @@ export DIALOG_ERROR=254 # sh(1) can't handle the default of `-1'
DIALOG_ESC=255
#
+# Set bsddialog(1) compatibility with dialog(1): exit codes and use_shadow
+#
+export BSDDIALOG_TIMEOUT=0
+export BSDDIALOG_ITEM_HELP=4
+export BSDDIALOG_ERROR=254
+export BSDDIALOG_ESC=255
+export BSDDIALOG_COMPATRC=".dialogrc"
+
+#
# Default behavior is to call f_dialog_init() automatically when loaded.
#
: ${DIALOG_SELF_INITIALIZE=1}
@@ -2229,7 +2238,7 @@ f_dialog_init()
if ! f_have $DIALOG; then
unset USE_XDIALOG
local failed_dialog="$DIALOG"
- DIALOG=dialog
+ DIALOG=bsddialog
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog"
fi
@@ -2261,7 +2270,7 @@ f_dialog_init()
if ! f_have xauth; then
# Die gracefully, as we [likely] can't use Xdialog(1)
unset USE_XDIALOG
- DIALOG=dialog
+ DIALOG=bsddialog
f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth"
fi
HOSTNAME=$( hostname )
@@ -2288,7 +2297,7 @@ f_dialog_init()
local height width
f_dialog_buttonbox_size height width \
"$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$maxsize"
- dialog \
+ bsddialog \
--title "$DIALOG_TITLE" \
--backtitle "$DIALOG_BACKTITLE" \
--ok-label "$msg_ok" \