From 6dd0be38a0450ec90f9e4684f0041d758f021eb9 Mon Sep 17 00:00:00 2001 From: dteske Date: Thu, 20 Jun 2013 05:51:44 +0000 Subject: [PATCH] When the fall-back of a case-statement is the last thing executed in a while-loop _and_ all prior matches in the same case-statement either break or continue, we can safely break the fall-back out of the case-statement. This should improve readability and allow for longer-lines by reducing the level of indentation by-one for the fall-back case. (a continuation of SVN r252019) --- usr.sbin/bsdconfig/startup/rcvar | 23 +++++++++++------------ usr.sbin/bsdconfig/usermgmt/groupdel | 13 ++++++------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar index d90092dcd177..784c433a358c 100755 --- a/usr.sbin/bsdconfig/startup/rcvar +++ b/usr.sbin/bsdconfig/startup/rcvar @@ -197,21 +197,20 @@ while :; do dialog_menu_main || f_die f_dialog_menutag_fetch mtag - case "$mtag" in - "X $msg_exit") break ;; - *) # Anything else is an rcvar to toggle - rcvar="${mtag# }" - f_dialog_menuitem_fetch value + [ "$mtag" = "X $msg_exit" ] && break - # Determine the new [toggled] value to use - case "$value" in - "[X]"*) value="NO" ;; - *) value="YES" - esac + # Anything else is an rcvar to toggle - err=$( f_sysrc_set "$rcvar" "$value" 2>&1 ) || - f_dialog_msgbox "$err" + rcvar="${mtag# }" + f_dialog_menuitem_fetch value + + # Determine the new [toggled] value to use + case "$value" in + "[X]"*) value="NO" ;; + *) value="YES" esac + + err=$( f_sysrc_set "$rcvar" "$value" 2>&1 ) || f_dialog_msgbox "$err" done exit $SUCCESS diff --git a/usr.sbin/bsdconfig/usermgmt/groupdel b/usr.sbin/bsdconfig/usermgmt/groupdel index 905e56fc0fb1..00e10784bce0 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupdel +++ b/usr.sbin/bsdconfig/usermgmt/groupdel @@ -77,13 +77,12 @@ while :; do [ $retval -eq 0 ] || f_die - case "$mtag" in - "X $msg_exit") break ;; - *) # anything else is a group name - $BSDCFG_LIBE/$APP_DIR/groupinput \ - ${USE_XDIALOG:+-X} mode="Delete" group="$mtag" - ;; - esac + [ "$mtag" = "X $msg_exit" ] && break + + # Anything else is a group name + + $BSDCFG_LIBE/$APP_DIR/groupinput \ + ${USE_XDIALOG:+-X} mode="Delete" group="$mtag" done exit $SUCCESS