Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2013 16:00:01 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252795 - in head/usr.sbin/bsdconfig: networking/share password password/share share share/media startup/share usermgmt usermgmt/share
Message-ID:  <201307051600.r65G01HZ084770@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Fri Jul  5 16:00:01 2013
New Revision: 252795
URL: http://svnweb.freebsd.org/changeset/base/252795

Log:
  Use f_show_msg() instead of f_dialog_msgbox() where appropriate. The main
  difference between these two functions:
  
  	Usage: f_show_msg() $format_string [ $format_args ... ]
  	Usage: f_dialog_msgbox() $text [ $hline ]
  
  The former lends itself well to displaying the $msg_* i18n text, prompts,
  etc. While the latter is better for text you do not control (error strings
  captured as a response from external commands) -- or if you have to control
  the hline.

Modified:
  head/usr.sbin/bsdconfig/networking/share/device.subr
  head/usr.sbin/bsdconfig/networking/share/resolv.subr
  head/usr.sbin/bsdconfig/password/password
  head/usr.sbin/bsdconfig/password/share/password.subr
  head/usr.sbin/bsdconfig/share/media/cdrom.subr
  head/usr.sbin/bsdconfig/share/media/dos.subr
  head/usr.sbin/bsdconfig/share/media/floppy.subr
  head/usr.sbin/bsdconfig/share/media/ftp.subr
  head/usr.sbin/bsdconfig/share/media/network.subr
  head/usr.sbin/bsdconfig/share/media/nfs.subr
  head/usr.sbin/bsdconfig/share/media/tcpip.subr
  head/usr.sbin/bsdconfig/share/media/usb.subr
  head/usr.sbin/bsdconfig/share/mustberoot.subr
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr
  head/usr.sbin/bsdconfig/usermgmt/groupinput
  head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
  head/usr.sbin/bsdconfig/usermgmt/userinput

Modified: head/usr.sbin/bsdconfig/networking/share/device.subr
==============================================================================
--- head/usr.sbin/bsdconfig/networking/share/device.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/networking/share/device.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -124,7 +124,7 @@ f_dialog_menu_netdev()
 		done
 	)
 	if [ ! "$interfaces" ]; then
-		f_dialog_msgbox "$msg_no_network_interfaces"
+		f_show_msg "$msg_no_network_interfaces"
 		return $FAILURE
 	fi
 

Modified: head/usr.sbin/bsdconfig/networking/share/resolv.subr
==============================================================================
--- head/usr.sbin/bsdconfig/networking/share/resolv.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/networking/share/resolv.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -371,9 +371,9 @@ f_dialog_input_nameserver()
 		local retval=$?
 		case $retval in
 		1) f_die 1 "$msg_internal_error_nsindex_value" "$nsindex" ;;
-		2) f_dialog_msgbox "$msg_resolv_conf_changed_while_editing"
+		2) f_show_msg "$msg_resolv_conf_changed_while_editing"
 		   return $retval ;;
-		3) f_dialog_msgbox "$msg_resolv_conf_entry_no_longer_exists"
+		3) f_show_msg "$msg_resolv_conf_entry_no_longer_exists"
 		   return $retval ;;
 		esac
 

Modified: head/usr.sbin/bsdconfig/password/password
==============================================================================
--- head/usr.sbin/bsdconfig/password/password	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/password/password	Fri Jul  5 16:00:01 2013	(r252795)
@@ -75,7 +75,7 @@ f_mustberoot_init
 if f_dialog_input_password; then
 	err=$( echo "$pw_password" | pw usermod $USER_ROOT -h 0 2>&1 ) ||
 		f_die $? "%s" "$err"
-	f_dialog_msgbox "$msg_password_changed"
+	f_show_msg "$msg_password_changed"
 fi
 
 return $SUCCESS

Modified: head/usr.sbin/bsdconfig/password/share/password.subr
==============================================================================
--- head/usr.sbin/bsdconfig/password/share/password.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/password/share/password.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -100,13 +100,13 @@ f_dialog_input_password()
 
 		# Check for NULL entry
 		if ! [ "$_password1" -o "$_password2" ]; then
-			f_dialog_msgbox "$msg_password_is_empty"
+			f_show_msg "$msg_password_is_empty"
 			continue
 		fi
 
 		# Check for password mismatch
 		if [ "$_password1" != "$_password2" ]; then
-			f_dialog_msgbox "$msg_passwords_do_not_match"
+			f_show_msg "$msg_passwords_do_not_match"
 			continue
 		fi
 

Modified: head/usr.sbin/bsdconfig/share/media/cdrom.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/cdrom.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/cdrom.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -61,7 +61,7 @@ f_media_set_cdrom()
 	ndevs=$( set -- $devs; echo $# )
 
 	if [ ${ndevs:=0} -eq 0 ]; then
-		f_interactive && f_dialog_msgbox "$msg_no_cd_dvd_devices_found"
+		f_interactive && f_show_msg "$msg_no_cd_dvd_devices_found"
 		return $FAILURE
 	elif [ $ndevs -gt 1 ]; then
 		local title="$msg_choose_a_cd_dvd_type"

Modified: head/usr.sbin/bsdconfig/share/media/dos.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/dos.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/dos.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -59,7 +59,7 @@ f_media_set_dos()
 	ndevs=$( set -- $devs; echo $# )
 
 	if [ ${ndevs:=0} -eq 0 ]; then
-		f_dialog_msgbox "$msg_no_dos_primary_partitions_found"
+		f_show_msg "$msg_no_dos_primary_partitions_found"
 		return $FAILURE
 	elif [ $ndevs -gt 1 ]; then
 		local title="$msg_choose_a_dos_partition"

Modified: head/usr.sbin/bsdconfig/share/media/floppy.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/floppy.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/floppy.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -60,7 +60,7 @@ f_media_set_floppy()
 	ndevs=$( set -- $devs; echo $# )
 
 	if [ ${ndevs:=0} -eq 0 ]; then
-		f_interactive && f_dialog_msgbox "$msg_no_floppy_devices_found"
+		f_interactive && f_show_msg "$msg_no_floppy_devices_found"
 		return $FAILURE
 	elif [ $ndevs -gt 1 ]; then
 		local title="$msg_choose_a_floppy_drive"

Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/ftp.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/ftp.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -630,8 +630,7 @@ f_media_init_ftp()
 			   ! f_getvar $VAR_FTP_PATH cp ||
 			   [ ! "$cp" ]
 			then
-				f_dialog_msgbox \
-					"$msg_unable_to_get_proper_ftp_path"
+				f_show_msg "$msg_unable_to_get_proper_ftp_path"
 				f_device_network_down $dev
 				return $FAILURE
 			fi
@@ -642,7 +641,7 @@ f_media_init_ftp()
 			f_getvar $VAR_FTP_HOST ftp_host &&
 			f_getvar $VAR_FTP_DIR ftp_dir
 		}; then
-			f_dialog_msgbox "$msg_missing_ftp_host_or_directory"
+			f_show_msg "$msg_missing_ftp_host_or_directory"
 			f_device_network_down $dev
 			return $FAILURE
 		fi

Modified: head/usr.sbin/bsdconfig/share/media/network.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/network.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/network.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -110,7 +110,7 @@ f_media_init_network()
 			local rp
 			f_getvar $VAR_GATEWAY rp
 			if [ ! "$rp" ]; then
-				f_dialog_msgbox "$msg_no_gateway_has_been_set"
+				f_show_msg "$msg_no_gateway_has_been_set"
 			else
 				#
 				# Explicitly flush all routes to get back to a
@@ -121,7 +121,7 @@ f_media_init_network()
 				f_quietly route -n flush
 				f_dprintf "Adding default route to %s." "$rp"
 				if ! f_quietly route -n add default "$rp"; then
-					f_dialog_msgbox \
+					f_show_msg \
 					    "$msg_failed_to_add_default_route"
 					return $FAILURE
 				fi

Modified: head/usr.sbin/bsdconfig/share/media/nfs.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/nfs.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/nfs.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -82,7 +82,7 @@ f_media_set_nfs()
 	case "$nfs" in
 	*:*) : valid NFS path ;;
 	*)
-		f_dialog_msgbox "$msg_invalid_nfs_path_specification"
+		f_show_msg "$msg_invalid_nfs_path_specification"
 		return $FAILURE
 	esac
 

Modified: head/usr.sbin/bsdconfig/share/media/tcpip.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/tcpip.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/tcpip.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -456,20 +456,20 @@ f_dialog_validate_tcpip()
 	local ipnum masknum
 
 	if [ ! "$hostname" ]; then
-		f_dialog_msgbox "$msg_must_specify_a_host_name_of_some_sort"
+		f_show_msg "$msg_must_specify_a_host_name_of_some_sort"
 	elif ! f_validate_hostname "$hostname"; then
-		f_dialog_msgbox "$msg_invalid_hostname_value"
+		f_show_msg "$msg_invalid_hostname_value"
 	elif [ "$netmask" ] && ! f_validate_netmask "$netmask"; then
-		f_dialog_msgbox "$msg_invalid_netmask_value"
+		f_show_msg "$msg_invalid_netmask_value"
 	elif [ "$nameserver" ] &&
-	      ! f_validate_ipaddr "$nameserver" &&
-	      ! f_validate_ipaddr6 "$nameserver"; then
-		f_dialog_msgbox "$msg_invalid_name_server_ip_address_specified"
+	     ! f_validate_ipaddr "$nameserver" &&
+	     ! f_validate_ipaddr6 "$nameserver"; then
+		f_show_msg "$msg_invalid_name_server_ip_address_specified"
 	elif [ "$ipaddr" ] && ! f_validate_ipaddr "$ipaddr" "$netmask"; then
-		f_dialog_msgbox "$msg_invalid_ipv4_address"
+		f_show_msg "$msg_invalid_ipv4_address"
 	elif [ "$gateway" -a "$gateway" != "NO" ] &&
-	      ! f_validate_gateway "$gateway" "$ipaddr" "$netmask"; then
-		f_dialog_msgbox "$msg_invalid_gateway_ipv4_address_specified"
+	     ! f_validate_gateway "$gateway" "$ipaddr" "$netmask"; then
+		f_show_msg "$msg_invalid_gateway_ipv4_address_specified"
 	else
 		return $SUCCESS
 	fi
@@ -1264,7 +1264,7 @@ f_device_dialog_tcp()
 	if f_netinteractive || f_interactive || [ ! "$_hostname" ]
 	then
 		[ ! "$_hostname" ] && f_interactive &&
-			f_dialog_msgbox "$msg_hostname_variable_not_set"
+			f_show_msg "$msg_hostname_variable_not_set"
 
 		local title=" $msg_network_configuration "
 		local hline="$hline_alnum_arrows_punc_tab_enter"
@@ -1593,7 +1593,7 @@ f_device_select_tcp()
 			fi
 		done
 
-		f_interactive && f_dialog_msgbox "$msg_no_network_devices"
+		f_interactive && f_show_msg "$msg_no_network_devices"
 		return $FAILURE
 
 	fi # $network_dev
@@ -1616,7 +1616,7 @@ f_device_select_tcp()
 
 	local retval=$SUCCESS
 	if [ ${cnt:=0} -eq 0 ]; then
-		f_dialog_msgbox "$msg_no_network_devices"
+		f_show_msg "$msg_no_network_devices"
 		retval=$FAILURE
 	elif [ $cnt -eq 1 ]; then
 		f_device_dialog_tcp $dev

Modified: head/usr.sbin/bsdconfig/share/media/usb.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/usb.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/media/usb.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -60,7 +60,7 @@ f_media_set_usb()
 	ndevs=$( set -- $devs; echo $# )
 
 	if [ ${ndevs:=0} -eq 0 ]; then
-		f_dialog_msgbox "$msg_no_usb_devices_found"
+		f_show_msg "$msg_no_usb_devices_found"
 		return $FAILURE
 	elif [ $ndevs -gt 1 ]; then
 		local title="$msg_choose_a_usb_drive"

Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/mustberoot.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/share/mustberoot.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -330,7 +330,7 @@ f_authenticate_some_user()
 		unset user_pass # scrub memory
 		if [ ! "$user" ]; then
 			nfailures=$(( $nfailures + 1 ))
-			f_dialog_msgbox "$msg_no_username"
+			f_show_msg "$msg_no_username"
 			continue
 		fi
 		if [ ! "$SECURE_ALLOW_ROOT" ]; then

Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr
==============================================================================
--- head/usr.sbin/bsdconfig/startup/share/rcconf.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -469,14 +469,14 @@ f_dialog_input_rcvar()
 
 		# Check for invalid entry (1of2)
 		if ! echo "$_input" | grep -q "^[[:alpha:]_]"; then
-			f_dialog_msgbox "$msg_rcvar_must_start_with"
+			f_show_msg "$msg_rcvar_must_start_with"
 			continue
 		fi
 
 		# Check for invalid entry (2of2)
 		if ! echo "$_input" | grep -q "^[[:alpha:]_][[:alnum:]_]*$"
 		then
-			f_dialog_msgbox "$msg_rcvar_contains_invalid_chars"
+			f_show_msg "$msg_rcvar_contains_invalid_chars"
 			continue
 		fi
 

Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/groupinput	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/usermgmt/groupinput	Fri Jul  5 16:00:01 2013	(r252795)
@@ -66,7 +66,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_group_deleted"
+		f_show_msg "$msg_group_deleted"
 		;;
 	Add)
 		local cmd="pw groupadd -n '$group_name'"
@@ -85,7 +85,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_group_added"
+		f_show_msg "$msg_group_added"
 		;;
 	Edit/View)
 		local cmd="pw groupmod -n '$group_name'"
@@ -104,7 +104,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_group_updated"
+		f_show_msg "$msg_group_updated"
 		;;
 	esac
 

Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -138,13 +138,13 @@ f_dialog_input_group_name()
 
 		# Check for NULL entry
 		if [ ! "$_input" ]; then
-			f_dialog_msgbox "$msg_group_is_empty"
+			f_show_msg "$msg_group_is_empty"
 			continue
 		fi
 
 		# Check for invalid entry
 		if ! echo "$_input" | grep -q "^[[:alpha:]]"; then
-			f_dialog_msgbox "$msg_group_must_start_with_letter"
+			f_show_msg "$msg_group_must_start_with_letter"
 			continue
 		fi
 
@@ -231,7 +231,7 @@ f_dialog_input_group_password()
 
 		# Check for password mismatch
 		if [ "$_password1" != "$_password2" ]; then
-			f_dialog_msgbox "$msg_group_passwords_do_not_match"
+			f_show_msg "$msg_group_passwords_do_not_match"
 			continue
 		fi
 

Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr	Fri Jul  5 16:00:01 2013	(r252795)
@@ -242,13 +242,13 @@ f_dialog_input_name()
 
 		# Check for NULL entry
 		if [ ! "$_input" ]; then
-			f_dialog_msgbox "$msg_login_is_empty"
+			f_show_msg "$msg_login_is_empty"
 			continue
 		fi
 
 		# Check for invalid entry
 		if ! echo "$_input" | grep -q "^[[:alpha:]]"; then
-			f_dialog_msgbox "$msg_login_must_start_with_letter"
+			f_show_msg "$msg_login_must_start_with_letter"
 			continue
 		fi
 
@@ -328,7 +328,7 @@ f_dialog_input_password()
 
 		# Check for password mismatch
 		if [ "$_password1" != "$_password2" ]; then
-			f_dialog_msgbox "$msg_passwords_do_not_match"
+			f_show_msg "$msg_passwords_do_not_match"
 			continue
 		fi
 
@@ -584,7 +584,7 @@ f_dialog_input_expire_password()
 
 			# Taint-check the user's input
 			if ! f_isinteger "$ret_days"; then
-				f_dialog_msgbox "$msg_invalid_number_of_days"
+				f_show_msg "$msg_invalid_number_of_days"
 				continue
 			fi
 
@@ -610,8 +610,7 @@ f_dialog_input_expire_password()
 
 			# Taint-check the user's input
 			if ! f_isinteger "${_input:-0}"; then
-				f_dialog_msgbox \
-					"$msg_invalid_number_of_seconds"
+				f_show_msg "$msg_invalid_number_of_seconds"
 				continue
 			fi
 
@@ -769,7 +768,7 @@ f_dialog_input_expire_account()
 
 			# Taint-check the user's input
 			if ! f_isinteger "$ret_days"; then
-				f_dialog_msgbox "$msg_invalid_number_of_days"
+				f_show_msg "$msg_invalid_number_of_days"
 				continue
 			fi
 
@@ -795,8 +794,7 @@ f_dialog_input_expire_account()
 
 			# Taint-check the user's input
 			if ! f_isinteger "${_input:-0}"; then
-				f_dialog_msgbox \
-					"$msg_invalid_number_of_seconds"
+				f_show_msg "$msg_invalid_number_of_seconds"
 				continue
 			fi
 

Modified: head/usr.sbin/bsdconfig/usermgmt/userinput
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/userinput	Fri Jul  5 15:57:36 2013	(r252794)
+++ head/usr.sbin/bsdconfig/usermgmt/userinput	Fri Jul  5 16:00:01 2013	(r252795)
@@ -84,7 +84,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_login_deleted"
+		f_show_msg "$msg_login_deleted"
 
 		if [ "$pw_group_delete" = "$msg_yes" ] &&
 		   f_quietly pw groupshow -g "$pw_gid"
@@ -122,7 +122,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_login_added"
+		f_show_msg "$msg_login_added"
 
 		if [ "$pw_home_create" = "$msg_yes" ]; then
 			err=$( mkdir -p "$pw_home_dir" 2>&1 )
@@ -168,7 +168,7 @@ save_changes()
 			f_dialog_msgbox "$msg_error $err\n"
 			return $retval
 		fi
-		f_dialog_msgbox "$msg_login_updated"
+		f_show_msg "$msg_login_updated"
 
 		if [ "$pw_home_create" = "$msg_yes" ]; then
 			err=$( mkdir -p "$pw_home_dir" )



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307051600.r65G01HZ084770>