summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-06-02 22:34:40 +0000
committerdteske <dteske@FreeBSD.org>2013-06-02 22:34:40 +0000
commit6ffb8bc7f6d4d5ba800c2d70733d9a242419bbdd (patch)
tree3eb19e76eb6d2cf52ec6aac7f416ee00680315c6
parent9d0ce6189690b6d7b4012fe28c3ebb3617861595 (diff)
downloadFreeBSD-src-6ffb8bc7f6d4d5ba800c2d70733d9a242419bbdd.zip
FreeBSD-src-6ffb8bc7f6d4d5ba800c2d70733d9a242419bbdd.tar.gz
Improvements to whitespace and comments.
-rwxr-xr-xusr.sbin/bsdconfig/bsdconfig1
-rw-r--r--usr.sbin/bsdconfig/networking/share/media.subr4
-rw-r--r--usr.sbin/bsdconfig/share/dialog.subr2
-rw-r--r--usr.sbin/bsdconfig/share/mustberoot.subr3
-rwxr-xr-xusr.sbin/bsdconfig/share/packages/packages.subr26
-rwxr-xr-xusr.sbin/bsdconfig/startup/misc2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcconf4
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcdelete7
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcvar6
-rw-r--r--usr.sbin/bsdconfig/startup/share/rcconf.subr6
-rw-r--r--usr.sbin/bsdconfig/usermgmt/share/group_input.subr6
-rw-r--r--usr.sbin/bsdconfig/usermgmt/share/user_input.subr28
12 files changed, 57 insertions, 38 deletions
diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig
index 5c51228..fdf4283 100755
--- a/usr.sbin/bsdconfig/bsdconfig
+++ b/usr.sbin/bsdconfig/bsdconfig
@@ -169,7 +169,6 @@ dialog_menu_main()
local hline=
local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }"
-
local menuitem menu_title menu_help menu_selection index=2
for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
diff --git a/usr.sbin/bsdconfig/networking/share/media.subr b/usr.sbin/bsdconfig/networking/share/media.subr
index 3c7f473..a2bbdf7 100644
--- a/usr.sbin/bsdconfig/networking/share/media.subr
+++ b/usr.sbin/bsdconfig/networking/share/media.subr
@@ -101,7 +101,9 @@ f_ifconfig_media()
# f_dialog_input_options $interface
#
-# Input custom interface options.
+# Input custom interface options. If the user does not press ESC or choose
+# Cancel/No, $options will hold the user's input. Default input is taken from
+# the same variable ($options).
#
f_dialog_input_options()
{
diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr
index 5fe309f..1da5320 100644
--- a/usr.sbin/bsdconfig/share/dialog.subr
+++ b/usr.sbin/bsdconfig/share/dialog.subr
@@ -1672,7 +1672,7 @@ f_dialog_inputstr_fetch()
#
# Prompt the user with a dialog(1) inputbox to enter some value. The inputbox
# remains until the the user presses ENTER or ESC, or otherwise ends the
-# editing session, by selecting `Cancel' for example.
+# editing session (by selecting `Cancel' for example).
#
# If the user presses ENTER, the exit status is zero (success), otherwise if
# the user presses ESC the exit status is 255, or if the user chose Cancel, the
diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr
index 0b134f8..a05ddc7 100644
--- a/usr.sbin/bsdconfig/share/mustberoot.subr
+++ b/usr.sbin/bsdconfig/share/mustberoot.subr
@@ -171,7 +171,8 @@ f_become_root_via_sudo()
--cancel-label "$msg_cancel" \
--password --inputbox "$prompt" \
$height $width \
- 2>&1 > /dev/null )
+ 2>&1 > /dev/null
+ )
retval=$?
# Catch X11-related errors
diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr
index dae80a1..d3c9f80 100755
--- a/usr.sbin/bsdconfig/share/packages/packages.subr
+++ b/usr.sbin/bsdconfig/share/packages/packages.subr
@@ -307,18 +307,18 @@ f_package_menu_categories()
$menu_list
local menu_choice
menu_choice=$( eval $DIALOG \
- --title \"\$DIALOG_TITLE\" \
- --backtitle \"\$DIALOG_BACKTITLE\" \
- --hline \"\$hline\" \
- --item-help \
- --default-item \"\$defaultitem\" \
- --ok-label \"$msg_select\" \
- --cancel-label \"$msg_cancel\" \
- --menu \"\$prompt\" \
- $height $width $rows \
- $menu_list \
- 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
- )
+ --title \"\$DIALOG_TITLE\" \
+ --backtitle \"\$DIALOG_BACKTITLE\" \
+ --hline \"\$hline\" \
+ --item-help \
+ --default-item \"\$defaultitem\" \
+ --ok-label \"$msg_select\" \
+ --cancel-label \"$msg_cancel\" \
+ --menu \"\$prompt\" \
+ $height $width $rows \
+ $menu_list \
+ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
+ )
local retval=$?
f_dialog_menutag_store -s "$menu_choice"
return $retval
@@ -353,7 +353,7 @@ f_package_index_get_page()
fi
}
-# f_package_menu_select $category [ $page [ $defaultitem ] ]
+# f_package_menu_select $category [$page [$defaultitem]]
#
# Display list of packages for $category, optionally $page N and with a default
# item selected. If $page is omitted, the first page is displayed (but this
diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc
index 7659d5f..b1241fa 100755
--- a/usr.sbin/bsdconfig/startup/misc
+++ b/usr.sbin/bsdconfig/startup/misc
@@ -63,6 +63,7 @@ dialog_menu_main()
local defaultitem= # Calculated below
local hline="$hline_arrows_tab_enter"
+ # List of variables we'll need from rc.conf(5)
local var_list="
accounting_enable
local_startup
@@ -75,6 +76,7 @@ dialog_menu_main()
startup_dirs
" # END-QUOTE
+ # Add i386-specific variables if appropriate
if [ "$UNAME_P" = "i386" ]; then
var_list="$var_list
apm_enable
diff --git a/usr.sbin/bsdconfig/startup/rcconf b/usr.sbin/bsdconfig/startup/rcconf
index 6a41b7e..0fef724 100755
--- a/usr.sbin/bsdconfig/startup/rcconf
+++ b/usr.sbin/bsdconfig/startup/rcconf
@@ -158,7 +158,9 @@ dialog_menu_main()
}'
)"
- set -f # noglob
+ set -f # set noglob because descriptions in the $menu_list may contain
+ # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)).
+ # This prevents dialog(1) from expanding wildcards in help line.
local height width rows
eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete
index 76701c8..2a112b6 100755
--- a/usr.sbin/bsdconfig/startup/rcdelete
+++ b/usr.sbin/bsdconfig/startup/rcdelete
@@ -194,7 +194,9 @@ dialog_menu_main()
done
menu_list="$menu_list $menu_buf"
- set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *)
+ set -f # set noglob because descriptions in the $menu_list may contain
+ # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)).
+ # This prevents dialog(1) from expanding wildcards in help line.
local height width rows
eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
@@ -249,11 +251,14 @@ dialog_menu_confirm_delete()
[ $# -ge 1 ] || return $FAILURE
+ # If asked to delete only one variable, simply ask and return
if [ $# -eq 1 ]; then
f_noyes "$msg_are_you_sure_you_want_to_delete" "$delete_vars"
return $?
fi
+ # Not reached unless requested to delete multiple variables
+ # Generate a menu to cleanly display the variables to be deleted
local var_list
var_list=$( for var in $*; do echo "$var"; done | sort -u )
menu_list=$(
diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar
index a7b32b3..7f6d52b 100755
--- a/usr.sbin/bsdconfig/startup/rcvar
+++ b/usr.sbin/bsdconfig/startup/rcvar
@@ -69,6 +69,8 @@ dialog_menu_main()
local hline="$hline_arrows_tab_enter"
local defaultitem= # Calculated below
+ # NOTE: Using a GLOBAL here because caller will need this list to turn
+ # the menu tag into the menu item with f_dialog_menutag2item()
RCVAR_MENU_LIST="
'X $msg_exit' '$msg_exit_this_menu'
${SHOW_DESC:+'$msg_exit_this_menu'}
@@ -124,7 +126,9 @@ dialog_menu_main()
}'
)"
- set -f # noglob
+ set -f # set noglob because descriptions in the $RCVAR_MENU_LIST may
+ # contain `*' and get expanded by dialog(1). This prevents
+ # dialog(1) from expanding wildcards in the help line.
local height width rows
eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
diff --git a/usr.sbin/bsdconfig/startup/share/rcconf.subr b/usr.sbin/bsdconfig/startup/share/rcconf.subr
index 6cfe509..e9310ce 100644
--- a/usr.sbin/bsdconfig/startup/share/rcconf.subr
+++ b/usr.sbin/bsdconfig/startup/share/rcconf.subr
@@ -278,6 +278,7 @@ f_dialog_input_view_details()
local defaultitem= # calculated below
local hline="$hline_arrows_tab_enter"
+ # Calculate marks for checkboxes and radio buttons
local md=" "
if [ "$SHOW_DESC" ]; then
md="X"
@@ -294,6 +295,7 @@ f_dialog_input_view_details()
defaultitem="3 ($m3) $msg_show_configured"
fi
+ # Create the menu list with the above-calculated marks
menu_list="
'R $msg_reset' '$msg_reset_desc'
'D [$md] $msg_desc' '$msg_desc_desc'
@@ -410,7 +412,9 @@ f_dialog_input_rclist()
}'
)"
- set -f # noglob
+ set -f # set noglob because descriptions in the $menu_list may contain
+ # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)).
+ # This prevents dialog(1) from expanding wildcards in help line.
local height width rows
eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
diff --git a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
index 1bb3819..ef45070 100644
--- a/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
+++ b/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
@@ -280,9 +280,9 @@ f_dialog_input_group_gid()
# f_dialog_input_group_members [$group_members]
#
-# Allow the user to modify a list of members for a given group. If the user does
-# not cancel or press ESC, the $group_members variable will hold the newly-
-# configured value upon return.
+# Allow the user to modify a list of members for a given group. If the user
+# does not cancel or press ESC, the $group_members variable will hold the
+# newly-configured value upon return.
#
f_dialog_input_group_members()
{
diff --git a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
index 63f4583..55bce70 100644
--- a/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
+++ b/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
@@ -280,18 +280,18 @@ f_dialog_input_password()
local height1 width1
f_dialog_inputbox_size height1 width1 \
- "$DIALOG_TITLE" \
- "$DIALOG_BACKTITLE" \
- "$prompt1" \
- "" \
- "$hline"
+ "$DIALOG_TITLE" \
+ "$DIALOG_BACKTITLE" \
+ "$prompt1" \
+ "" \
+ "$hline"
local height2 width2
f_dialog_inputbox_size height2 width2 \
- "$DIALOG_TITLE" \
- "$DIALOG_BACKTITLE" \
- "$prompt2" \
- "" \
- "$hline"
+ "$DIALOG_TITLE" \
+ "$DIALOG_BACKTITLE" \
+ "$prompt2" \
+ "" \
+ "$hline"
#
# Loop until the user provides taint-free/valid input
@@ -496,9 +496,9 @@ f_dialog_input_change()
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
- retval=$?
+ retval=$?
f_dialog_data_sanitize date_type
- f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
+ f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
@@ -677,9 +677,9 @@ f_dialog_input_expire()
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
- retval=$?
+ retval=$?
f_dialog_data_sanitize date_type
- f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
+ f_dprintf "retval=%u date_type=[%s]" $retval "$date_type"
# Return if user has either pressed ESC or chosen Cancel/No
[ $retval -eq $SUCCESS ] || return $retval
OpenPOWER on IntegriCloud