From 0ac55ea171e6d82b0acc861ebcb19fb4db4958c4 Mon Sep 17 00:00:00 2001 From: dteske Date: Fri, 5 Jul 2013 16:00:01 +0000 Subject: 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. --- usr.sbin/bsdconfig/networking/share/device.subr | 2 +- usr.sbin/bsdconfig/networking/share/resolv.subr | 4 ++-- usr.sbin/bsdconfig/password/password | 2 +- usr.sbin/bsdconfig/password/share/password.subr | 4 ++-- usr.sbin/bsdconfig/share/media/cdrom.subr | 2 +- usr.sbin/bsdconfig/share/media/dos.subr | 2 +- usr.sbin/bsdconfig/share/media/floppy.subr | 2 +- usr.sbin/bsdconfig/share/media/ftp.subr | 5 ++--- usr.sbin/bsdconfig/share/media/network.subr | 4 ++-- usr.sbin/bsdconfig/share/media/nfs.subr | 2 +- usr.sbin/bsdconfig/share/media/tcpip.subr | 24 +++++++++++----------- usr.sbin/bsdconfig/share/media/usb.subr | 2 +- usr.sbin/bsdconfig/share/mustberoot.subr | 2 +- usr.sbin/bsdconfig/startup/share/rcconf.subr | 4 ++-- usr.sbin/bsdconfig/usermgmt/groupinput | 6 +++--- usr.sbin/bsdconfig/usermgmt/share/group_input.subr | 6 +++--- usr.sbin/bsdconfig/usermgmt/share/user_input.subr | 16 +++++++-------- usr.sbin/bsdconfig/usermgmt/userinput | 6 +++--- 18 files changed, 46 insertions(+), 49 deletions(-) (limited to 'usr.sbin/bsdconfig') diff --git a/usr.sbin/bsdconfig/networking/share/device.subr b/usr.sbin/bsdconfig/networking/share/device.subr index 133bca0..2bb7ba2 100644 --- a/usr.sbin/bsdconfig/networking/share/device.subr +++ b/usr.sbin/bsdconfig/networking/share/device.subr @@ -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 diff --git a/usr.sbin/bsdconfig/networking/share/resolv.subr b/usr.sbin/bsdconfig/networking/share/resolv.subr index 866f345..01b28af 100644 --- a/usr.sbin/bsdconfig/networking/share/resolv.subr +++ b/usr.sbin/bsdconfig/networking/share/resolv.subr @@ -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 diff --git a/usr.sbin/bsdconfig/password/password b/usr.sbin/bsdconfig/password/password index 2a69dfd..20c0f14 100755 --- a/usr.sbin/bsdconfig/password/password +++ b/usr.sbin/bsdconfig/password/password @@ -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 diff --git a/usr.sbin/bsdconfig/password/share/password.subr b/usr.sbin/bsdconfig/password/share/password.subr index 5002e41..05db7f1 100644 --- a/usr.sbin/bsdconfig/password/share/password.subr +++ b/usr.sbin/bsdconfig/password/share/password.subr @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/cdrom.subr b/usr.sbin/bsdconfig/share/media/cdrom.subr index 4350367..b3c5bae 100644 --- a/usr.sbin/bsdconfig/share/media/cdrom.subr +++ b/usr.sbin/bsdconfig/share/media/cdrom.subr @@ -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" diff --git a/usr.sbin/bsdconfig/share/media/dos.subr b/usr.sbin/bsdconfig/share/media/dos.subr index 9320c2c..b40c125 100644 --- a/usr.sbin/bsdconfig/share/media/dos.subr +++ b/usr.sbin/bsdconfig/share/media/dos.subr @@ -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" diff --git a/usr.sbin/bsdconfig/share/media/floppy.subr b/usr.sbin/bsdconfig/share/media/floppy.subr index beb574e..9eac78e 100644 --- a/usr.sbin/bsdconfig/share/media/floppy.subr +++ b/usr.sbin/bsdconfig/share/media/floppy.subr @@ -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" diff --git a/usr.sbin/bsdconfig/share/media/ftp.subr b/usr.sbin/bsdconfig/share/media/ftp.subr index fb96b91..080193c 100644 --- a/usr.sbin/bsdconfig/share/media/ftp.subr +++ b/usr.sbin/bsdconfig/share/media/ftp.subr @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/network.subr b/usr.sbin/bsdconfig/share/media/network.subr index d9fe8e6..ebce558 100644 --- a/usr.sbin/bsdconfig/share/media/network.subr +++ b/usr.sbin/bsdconfig/share/media/network.subr @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/nfs.subr b/usr.sbin/bsdconfig/share/media/nfs.subr index 86bdde2..00ec85d 100644 --- a/usr.sbin/bsdconfig/share/media/nfs.subr +++ b/usr.sbin/bsdconfig/share/media/nfs.subr @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/tcpip.subr b/usr.sbin/bsdconfig/share/media/tcpip.subr index 0daada6..8cb02bc 100644 --- a/usr.sbin/bsdconfig/share/media/tcpip.subr +++ b/usr.sbin/bsdconfig/share/media/tcpip.subr @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/usb.subr b/usr.sbin/bsdconfig/share/media/usb.subr index c2ece47..02c5f32 100644 --- a/usr.sbin/bsdconfig/share/media/usb.subr +++ b/usr.sbin/bsdconfig/share/media/usb.subr @@ -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" diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index e299fb2..46fce7c 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -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 diff --git a/usr.sbin/bsdconfig/startup/share/rcconf.subr b/usr.sbin/bsdconfig/startup/share/rcconf.subr index bb8237f..8016037 100644 --- a/usr.sbin/bsdconfig/startup/share/rcconf.subr +++ b/usr.sbin/bsdconfig/startup/share/rcconf.subr @@ -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 diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput index f84f618..6fff40f 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupinput +++ b/usr.sbin/bsdconfig/usermgmt/groupinput @@ -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 diff --git a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr index babcee7..93d981a 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr @@ -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 diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr index 7cdd2f0..21bfbd3 100644 --- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr +++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr @@ -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 diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput index 06221e1..196262b 100755 --- a/usr.sbin/bsdconfig/usermgmt/userinput +++ b/usr.sbin/bsdconfig/usermgmt/userinput @@ -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" ) -- cgit v1.1