summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-06-18 21:44:35 +0000
committerdteske <dteske@FreeBSD.org>2013-06-18 21:44:35 +0000
commite1afea6c7ee734fbdedaca02749e0fb178200c36 (patch)
treedba39d4168e5d82fbe343b9942b78de087aab01c /usr.sbin
parente126a17bd263caf562796096aba9da73f641d793 (diff)
downloadFreeBSD-src-e1afea6c7ee734fbdedaca02749e0fb178200c36.zip
FreeBSD-src-e1afea6c7ee734fbdedaca02749e0fb178200c36.tar.gz
Perform some code consolidation and add some additional error
checking/reporting. (similar to SVN revisions 251919 and 251928)
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdconfig/console/console27
-rw-r--r--usr.sbin/bsdconfig/console/include/messages.subr1
-rw-r--r--usr.sbin/bsdconfig/startup/include/messages.subr1
-rwxr-xr-xusr.sbin/bsdconfig/startup/startup19
-rw-r--r--usr.sbin/bsdconfig/usermgmt/include/messages.subr1
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/usermgmt44
6 files changed, 44 insertions, 49 deletions
diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console
index 7be4ff5..02ab63b 100755
--- a/usr.sbin/bsdconfig/console/console
+++ b/usr.sbin/bsdconfig/console/console
@@ -121,21 +121,22 @@ while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
+ command=
case "$mtag" in
- "X $msg_exit") break ;;
- "2 $msg_font") # Choose an alternate screen font
- $BSDCFG_LIBE/$APP_DIR/font ${USE_XDIALOG:+-X} ;;
- "3 $msg_keymap") # Choose an alternate keyboard map
- $BSDCFG_LIBE/$APP_DIR/keymap ${USE_XDIALOG:+-X} ;;
- "4 $msg_repeat") # Set the rate at which keys repeat
- $BSDCFG_LIBE/$APP_DIR/repeat ${USE_XDIALOG:+-X} ;;
- "5 $msg_saver") # Configure the screen saver
- $BSDCFG_LIBE/$APP_DIR/saver ${USE_XDIALOG:+-X} ;;
- "6 $msg_screenmap") # Choose an alternate screenmap
- $BSDCFG_LIBE/$APP_DIR/screenmap ${USE_XDIALOG:+-X} ;;
- "7 $msg_ttys") # Choose console terminal type
- $BSDCFG_LIBE/$APP_DIR/ttys ${USE_XDIALOG:+-X} ;;
+ "X $msg_exit") break ;;
+ "2 $msg_font") command=font ;; # Choose alternate screen font
+ "3 $msg_keymap") command=keymap ;; # Choose alt. keyboard map
+ "4 $msg_repeat") command=repeat ;; # Set key repeat rate
+ "5 $msg_saver") command=saver ;; # Configure the screen saver
+ "6 $msg_screenmap") command=screenmap ;; # Choose alternate screenmap
+ "7 $msg_ttys") command=ttys ;; # Choose console terminal type
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} ;;
+ else
+ f_die 1 "$msg_unknown_console_menu_selection"
+ fi
done
exit $SUCCESS
diff --git a/usr.sbin/bsdconfig/console/include/messages.subr b/usr.sbin/bsdconfig/console/include/messages.subr
index d5bbebb..11e3022 100644
--- a/usr.sbin/bsdconfig/console/include/messages.subr
+++ b/usr.sbin/bsdconfig/console/include/messages.subr
@@ -241,6 +241,7 @@ msg_ukrainian_koi8_u="Ukranian KOI8-U"
msg_ukrainian_koi8_u_desc="Ukranian KOI8-U keymap"
msg_ukrainian_koi8_u_koi8_r="Ukranian KOI8-U+KOI8-R"
msg_ukrainian_koi8_u_koi8_r_desc="Ukranian KOI8-U+KOI8-R keymap (alter)"
+msg_unknown_console_menu_selection="Unknown console menu selection"
msg_unknown_font_selection="Unknown font selection"
msg_unknown_keymap="Unknown keymap"
msg_unknown_repeat_rate="Unknown repeat rate"
diff --git a/usr.sbin/bsdconfig/startup/include/messages.subr b/usr.sbin/bsdconfig/startup/include/messages.subr
index 26253de..87bde26 100644
--- a/usr.sbin/bsdconfig/startup/include/messages.subr
+++ b/usr.sbin/bsdconfig/startup/include/messages.subr
@@ -104,6 +104,7 @@ msg_startup_dirs_desc="Set the list of dirs to look for startup scripts"
msg_svr4="SVR4"
msg_svr4_desc="This host wants to be able to run SVR4 binaries."
msg_toggle_startup_services="Toggle Startup Services"
+msg_unknown_startup_menu_selection="Unknown startup menu selection"
msg_value_required="Value Required"
msg_view_details="View Details"
msg_view_details_desc="Choose view details"
diff --git a/usr.sbin/bsdconfig/startup/startup b/usr.sbin/bsdconfig/startup/startup
index 55a78a6..e539d00 100755
--- a/usr.sbin/bsdconfig/startup/startup
+++ b/usr.sbin/bsdconfig/startup/startup
@@ -118,16 +118,19 @@ while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
+ command=
case "$mtag" in
- X) # Exit
- break ;;
- 1) # Toggle Startup Services
- $BSDCFG_LIBE/$APP_DIR/rcvar ${USE_XDIALOG:+-X} ;;
- 2) # View/Edit Startup Configuration
- $BSDCFG_LIBE/$APP_DIR/rcconf ${USE_XDIALOG:+-X} ;;
- 3) # Miscellaneous Startup Services
- $BSDCFG_LIBE/$APP_DIR/misc ${USE_XDIALOG:+-X} ;;
+ X) break ;;
+ 1) command=rcvar ;; # Toggle Startup Services
+ 2) command=rcconf ;; # View/Edit Startup Configuration
+ 3) command=misc ;; # Miscellaneous Startup Services
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} ;;
+ else
+ f_die 1 "$msg_unknown_startup_menu_selection"
+ fi
done
exit $SUCCESS
diff --git a/usr.sbin/bsdconfig/usermgmt/include/messages.subr b/usr.sbin/bsdconfig/usermgmt/include/messages.subr
index aa98407..71cc51d 100644
--- a/usr.sbin/bsdconfig/usermgmt/include/messages.subr
+++ b/usr.sbin/bsdconfig/usermgmt/include/messages.subr
@@ -105,6 +105,7 @@ msg_separated_by_commas="Separated by commas"
msg_select_group_members_from_list="Select Group Members from a list"
msg_select_login_shell="Select Login Shell"
msg_shell="Shell"
+msg_unknown_user_management_menu_selection="Unknown user management menu selection"
msg_use_default_values_for_all_account_details="Use default values for all account details?"
msg_user="User"
msg_user_id="UID"
diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt
index 96f7e6f..b7d36b9 100755
--- a/usr.sbin/bsdconfig/usermgmt/usermgmt
+++ b/usr.sbin/bsdconfig/usermgmt/usermgmt
@@ -144,38 +144,26 @@ while :; do
f_die
fi
+ command=
case "$mtag" in
- X) # Exit
- exit 0
- ;;
-
- 1) # Add User
- $BSDCFG_LIBE/$APP_DIR/useradd ${USE_XDIALOG:+-X}
- ;;
-
- 2) # Edit/View User
- $BSDCFG_LIBE/$APP_DIR/useredit ${USE_XDIALOG:+-X}
- ;;
-
- 3) # Delete User
- $BSDCFG_LIBE/$APP_DIR/userdel ${USE_XDIALOG:+-X}
- ;;
-
- 4) # Add Group
- $BSDCFG_LIBE/$APP_DIR/groupadd ${USE_XDIALOG:+-X}
- ;;
-
- 5) # Edit/View Group
- $BSDCFG_LIBE/$APP_DIR/groupedit ${USE_XDIALOG:+-X}
- ;;
-
- 6) # Delete Group
- $BSDCFG_LIBE/$APP_DIR/groupdel ${USE_XDIALOG:+-X}
- ;;
-
+ X) break ;;
+ 1) command=useradd ;; # Add User
+ 2) command=useredit ;; # Edit/View User
+ 3) command=userdel ;; # Delete User
+ 4) command=groupadd ;; # Add Group
+ 5) command=groupedit ;; # Edit/View Group
+ 6) command=groupdel ;; # Delete Group
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
+ else
+ f_die 1 "$msg_unknown_user_management_menu_selection"
+ fi
done
+exit $SUCCESS
+
################################################################################
# END
################################################################################
OpenPOWER on IntegriCloud