Fix a bug introduced by r251236; product of bug was the following error in

"Startup"->"View/Edit Startup Configuration"->"Add New"->"Add From List":

[: -eq: unexpected operator

NOTE: Previously mentioned in r251557

Problem caused by removal of $retval to capture exit status of call to
f_dialog_input_rclist().

While we're here, enhance f_dialog_input_rclist() to accept a default-item
to make selecting multiple values to-add more efficient.
This commit is contained in:
Devin Teske 2013-06-09 15:36:13 +00:00
parent 42cb36d269
commit 641cb9ccd9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251579
2 changed files with 10 additions and 10 deletions

View File

@ -120,27 +120,25 @@ while :; do
case "$mtag" in
1) # Add From List
# Loop for easy return
# Loop to allow adding multiple variables quickly
defaultitem=
while :; do
f_dialog_input_rclist || break
f_dialog_input_rclist "$defaultitem" || f_die
f_dialog_menutag_fetch mtag
defaultitem="$mtag"
case "$mtag" in
"X $msg_exit" ) break ;;
*) # Anything else is a directive
rcvar="${mtag# }"
$BSDCFG_LIBE/$APP_DIR/rcedit \
${USE_XDIALOG:+-X} \
"$rcvar" || continue
${USE_XDIALOG:+-X} "$rcvar"
esac
break
done
[ $retval -eq 0 ] || continue
;;
2) # Add Custom
f_dialog_input_rcvar || continue
$BSDCFG_LIBE/$APP_DIR/rcedit ${USE_XDIALOG:+-X} "$rcvar" ||
continue
$BSDCFG_LIBE/$APP_DIR/rcedit ${USE_XDIALOG:+-X} "$rcvar"
;;
esac
done

View File

@ -365,12 +365,12 @@ f_dialog_input_view_details()
esac
}
# f_dialog_input_rclist
# f_dialog_input_rclist [$default]
#
# Presents a menu of rc.conf(5) defaults (with, or without descriptions). This
# function should be treated like a call to dialog(1) (the exit status should
# be captured and f_dialog_menutag_fetch() should be used to get the user's
# response).
# response). Optionally if present and non-null, highlight $default rcvar.
#
f_dialog_input_rclist()
{
@ -378,6 +378,7 @@ f_dialog_input_rclist()
local menu_list="
'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_this_menu'}
" # END-QUOTE
local defaultitem="$1"
local hline="$hline_arrows_tab_enter"
if [ ! "$_RCCONF_MAP" ]; then
@ -434,6 +435,7 @@ f_dialog_input_rclist()
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
--hline \"\$hline\" \
--default-item \"\$defaultitem\" \
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
${SHOW_DESC:+--item-help} \