Author: dteske
Date: Sun Jun  9 15:36:13 2013
New Revision: 251579
URL: http://svnweb.freebsd.org/changeset/base/251579

Log:
  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.

Modified:
  head/usr.sbin/bsdconfig/startup/rcadd
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr

Modified: head/usr.sbin/bsdconfig/startup/rcadd
==============================================================================
--- head/usr.sbin/bsdconfig/startup/rcadd       Sun Jun  9 15:19:33 2013        
(r251578)
+++ head/usr.sbin/bsdconfig/startup/rcadd       Sun Jun  9 15:36:13 2013        
(r251579)
@@ -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

Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr
==============================================================================
--- head/usr.sbin/bsdconfig/startup/share/rcconf.subr   Sun Jun  9 15:19:33 
2013        (r251578)
+++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr   Sun Jun  9 15:36:13 
2013        (r251579)
@@ -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}          \
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to