summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-06-20 05:48:08 +0000
committerdteske <dteske@FreeBSD.org>2013-06-20 05:48:08 +0000
commit1a1d811a616414b6c513fdaec7249b7037a7cac4 (patch)
tree42ad8171e52871433358a5a88976ed211469abf8 /usr.sbin
parent8fb422656d21d27cca45cc9aa25bf8bb8a0ea2ea (diff)
downloadFreeBSD-src-1a1d811a616414b6c513fdaec7249b7037a7cac4.zip
FreeBSD-src-1a1d811a616414b6c513fdaec7249b7037a7cac4.tar.gz
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.
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdconfig/bsdconfig22
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcadd13
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupedit13
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userdel13
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useredit13
5 files changed, 33 insertions, 41 deletions
diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig
index fb728f7..959efa0 100755
--- a/usr.sbin/bsdconfig/bsdconfig
+++ b/usr.sbin/bsdconfig/bsdconfig
@@ -330,25 +330,21 @@ while :; do
fi
case "$mtag" in
- X) # Exit
- break
- ;;
-
+ X) break ;;
1) # Usage
f_show_help "$USAGE_HELPFILE"
continue
- ;;
+ esac
- *) # Dynamically loaded menuitem
- f_getvar menu_program$mtag menu_program
- case "$menu_program" in
- /*) cmd="$menu_program";;
- *) cmd="$BSDCFG_LIBE/$menu_program"
- esac
- f_dprintf "cmd=[%s]" "$cmd"
- $cmd ${USE_XDIALOG:+-X}
+ # Anything else is a dynamically loaded menuitem
+ f_getvar menu_program$mtag menu_program
+ case "$menu_program" in
+ /*) cmd="$menu_program";;
+ *) cmd="$BSDCFG_LIBE/$menu_program"
esac
+ f_dprintf "cmd=[%s]" "$cmd"
+ $cmd ${USE_XDIALOG:+-X}
done
exit $SUCCESS
diff --git a/usr.sbin/bsdconfig/startup/rcadd b/usr.sbin/bsdconfig/startup/rcadd
index eb4c3d9..4a591f4 100755
--- a/usr.sbin/bsdconfig/startup/rcadd
+++ b/usr.sbin/bsdconfig/startup/rcadd
@@ -127,13 +127,12 @@ while :; do
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"
- esac
+ [ "$mtag" = "X $msg_exit" ] && break
+
+ # Anything else is a directive
+
+ $BSDCFG_LIBE/$APP_DIR/rcedit ${USE_XDIALOG:+-X} \
+ "${mtag# }"
done
;;
2) # Add Custom
diff --git a/usr.sbin/bsdconfig/usermgmt/groupedit b/usr.sbin/bsdconfig/usermgmt/groupedit
index eab3bbf..032d656 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupedit
+++ b/usr.sbin/bsdconfig/usermgmt/groupedit
@@ -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="Edit/View" group="$mtag"
- ;;
- esac
+ [ "$mtag" = "X $msg_exit" ] && break
+
+ # Anything else is a group name
+
+ $BSDCFG_LIBE/$APP_DIR/groupinput \
+ ${USE_XDIALOG:+-X} mode="Edit/View" group="$mtag"
done
exit $SUCCESS
diff --git a/usr.sbin/bsdconfig/usermgmt/userdel b/usr.sbin/bsdconfig/usermgmt/userdel
index 2a34ba1..73357bd 100755
--- a/usr.sbin/bsdconfig/usermgmt/userdel
+++ b/usr.sbin/bsdconfig/usermgmt/userdel
@@ -77,13 +77,12 @@ while :; do
[ $retval -eq 0 ] || f_die
- case "$mtag" in
- "X $msg_exit") break ;;
- *) # anything else is a userid
- $BSDCFG_LIBE/$APP_DIR/userinput \
- ${USE_XDIALOG:+-X} mode="Delete" user="$mtag"
- ;;
- esac
+ [ "$mtag" = "X $msg_exit" ] && break
+
+ # Anything else is a userid
+
+ $BSDCFG_LIBE/$APP_DIR/userinput \
+ ${USE_XDIALOG:+-X} mode="Delete" user="$mtag"
done
exit $SUCCESS
diff --git a/usr.sbin/bsdconfig/usermgmt/useredit b/usr.sbin/bsdconfig/usermgmt/useredit
index 0e8fd12..e34fd2e 100755
--- a/usr.sbin/bsdconfig/usermgmt/useredit
+++ b/usr.sbin/bsdconfig/usermgmt/useredit
@@ -77,13 +77,12 @@ while :; do
[ $retval -eq 0 ] || f_die
- case "$mtag" in
- "X $msg_exit") break ;;
- *) # anything else is a userid
- $BSDCFG_LIBE/$APP_DIR/userinput \
- ${USE_XDIALOG:+-X} mode="Edit/View" user="$mtag"
- ;;
- esac
+ [ "$mtag" = "X $msg_exit" ] && break
+
+ # Anything else is a userid
+
+ $BSDCFG_LIBE/$APP_DIR/userinput \
+ ${USE_XDIALOG:+-X} mode="Edit/View" user="$mtag"
done
exit $SUCCESS
OpenPOWER on IntegriCloud