Author: dteske
Date: Tue Jun 18 09:28:49 2013
New Revision: 251919
URL: http://svnweb.freebsd.org/changeset/base/251919

Log:
  Perform some code consolidation and add some additional error
  checking/reporting. (similar to SVN revisions 251905 and 251915)

Modified:
  head/usr.sbin/bsdconfig/mouse/include/messages.subr
  head/usr.sbin/bsdconfig/mouse/mouse

Modified: head/usr.sbin/bsdconfig/mouse/include/messages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/mouse/include/messages.subr Tue Jun 18 09:26:01 
2013        (r251918)
+++ head/usr.sbin/bsdconfig/mouse/include/messages.subr Tue Jun 18 09:28:49 
2013        (r251919)
@@ -86,6 +86,7 @@ msg_thinkingmouse="ThinkingMouse"
 msg_thinkingmouse_desc="Kensington ThinkingMouse (serial)"
 msg_trying_to_start_the_mouse_daemon="Trying to start the mouse daemon..."
 msg_type="Type"
+msg_unknown_mouse_menu_selection="Unknown mouse menu selection"
 msg_unknown_mouse_port_selection="Unknown mouse port selection"
 msg_unknown_mouse_protocol_selection="Unknown mouse protocol selection"
 msg_user_confirmation_requested="User Confirmation Requested"

Modified: head/usr.sbin/bsdconfig/mouse/mouse
==============================================================================
--- head/usr.sbin/bsdconfig/mouse/mouse Tue Jun 18 09:26:01 2013        
(r251918)
+++ head/usr.sbin/bsdconfig/mouse/mouse Tue Jun 18 09:28:49 2013        
(r251919)
@@ -120,19 +120,21 @@ while :; do
        dialog_menu_main || f_die
        f_dialog_menutag_fetch mtag
 
+       command=
        case "$mtag" in
-       "X $msg_exit") break ;;
-       "2 $msg_enable") # Test and run the mouse daemon
-               $BSDCFG_LIBE/$APP_DIR/enable ${USE_XDIALOG:+-X} ;;
-       "3 $msg_type") # Select mouse protocol type
-               $BSDCFG_LIBE/$APP_DIR/type ${USE_XDIALOG:+-X} ;;
-       "4 $msg_port") # Select mouse port
-               $BSDCFG_LIBE/$APP_DIR/port ${USE_XDIALOG:+-X} ;;
-       "5 $msg_flags") # Set additional flags
-               $BSDCFG_LIBE/$APP_DIR/flags ${USE_XDIALOG:+-X} ;;
-       "6 $msg_disable") # Disable the mouse daemon
-               $BSDCFG_LIBE/$APP_DIR/disable ${USE_XDIALOG:+-X} ;;
+       "X $msg_exit")    break ;;
+       "2 $msg_enable")  command=enable  ;; # Test and run the mouse daemon
+       "3 $msg_type")    command=type    ;; # Select mouse protocol type
+       "4 $msg_port")    command=port    ;; # Select mouse port
+       "5 $msg_flags")   command=flags   ;; # Set additional flags
+       "6 $msg_disable") command=disable ;; # Disable the mouse daemon
        esac
+
+       if [ "$command" ]; then
+               $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} ;;
+       else
+               f_die 1 "$msg_unknown_mouse_menu_selection"
+       fi
 done
 
 exit $SUCCESS
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to