Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2013 22:34:40 +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: r251266 - in head/usr.sbin/bsdconfig: . networking/share share share/packages startup startup/share usermgmt/share
Message-ID:  <201306022234.r52MYeAP078379@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Sun Jun  2 22:34:40 2013
New Revision: 251266
URL: http://svnweb.freebsd.org/changeset/base/251266

Log:
  Improvements to whitespace and comments.

Modified:
  head/usr.sbin/bsdconfig/bsdconfig
  head/usr.sbin/bsdconfig/networking/share/media.subr
  head/usr.sbin/bsdconfig/share/dialog.subr
  head/usr.sbin/bsdconfig/share/mustberoot.subr
  head/usr.sbin/bsdconfig/share/packages/packages.subr
  head/usr.sbin/bsdconfig/startup/misc
  head/usr.sbin/bsdconfig/startup/rcconf
  head/usr.sbin/bsdconfig/startup/rcdelete
  head/usr.sbin/bsdconfig/startup/rcvar
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr
  head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr

Modified: head/usr.sbin/bsdconfig/bsdconfig
==============================================================================
--- head/usr.sbin/bsdconfig/bsdconfig	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/bsdconfig	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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

Modified: head/usr.sbin/bsdconfig/networking/share/media.subr
==============================================================================
--- head/usr.sbin/bsdconfig/networking/share/media.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/networking/share/media.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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()
 {

Modified: head/usr.sbin/bsdconfig/share/dialog.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/dialog.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/share/dialog.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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

Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/mustberoot.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/share/mustberoot.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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

Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/packages/packages.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/share/packages/packages.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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

Modified: head/usr.sbin/bsdconfig/startup/misc
==============================================================================
--- head/usr.sbin/bsdconfig/startup/misc	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/startup/misc	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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

Modified: head/usr.sbin/bsdconfig/startup/rcconf
==============================================================================
--- head/usr.sbin/bsdconfig/startup/rcconf	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/startup/rcconf	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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 \

Modified: head/usr.sbin/bsdconfig/startup/rcdelete
==============================================================================
--- head/usr.sbin/bsdconfig/startup/rcdelete	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/startup/rcdelete	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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=$(

Modified: head/usr.sbin/bsdconfig/startup/rcvar
==============================================================================
--- head/usr.sbin/bsdconfig/startup/rcvar	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/startup/rcvar	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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 \

Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr
==============================================================================
--- head/usr.sbin/bsdconfig/startup/share/rcconf.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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 \

Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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()
 {

Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr	Sun Jun  2 22:04:39 2013	(r251265)
+++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr	Sun Jun  2 22:34:40 2013	(r251266)
@@ -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



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