summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/networking
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-06-02 20:02:50 +0000
committerdteske <dteske@FreeBSD.org>2013-06-02 20:02:50 +0000
commite9cea3453922d1975e0825166772ffe465661dab (patch)
tree2c9bf92c5092f58cc207f2fd3418feab48459fea /usr.sbin/bsdconfig/networking
parentdb074b4e6ec9f60ba7d39270d7bd41bd4d5f6ba8 (diff)
downloadFreeBSD-src-e9cea3453922d1975e0825166772ffe465661dab.zip
FreeBSD-src-e9cea3453922d1975e0825166772ffe465661dab.tar.gz
Standardize the way functions build their arguments leading up to a dialog
invocation. Specifically, "top-load" your arguments and in the order in- which they will be displayed. For example, many [if not all] widgets display information in the following order, top-to-bottom (visually): + backtitle (displayed behind the widget at top-left) + title (at the top of the `window') + prompt text (just below the title and above whatever widget you choose) + Depending on widget, _one_ of the following: - menu list - radio list - check list - text input box with initial text - [Xdialog(1)] 2x or 3x text input boxes - [dialog(1)] a multi-part form - progress bar - etc. (many more widget choices) + buttons (right below the selected widget) + [dialog(1)] the hline (displayed at bottom of `window') NOTE: Xdialog(1) accepts and silently ignores --hline When building local arguments for your dialog invocation, if the value can't be cleanly loaded into a local, add "# Calculated below" to the end of the local declaration while retaining the block order of argument declarations. Move other local declarations that are not associated with this top-loading the dialog arguments to right-above where they are first-used. Also, standardize on the names of the arguments. For example, always use $prompt (instead of sometimes $msg and sometimes $prompt); use $menu_list or $shell_list or $radio_list for those respective widgets; ad nauseum. While we're doing this, flush-out full arguments for many invocations that were passing NULL strings (making it unapparent if you were staring at this one invocation what argument that NULL string was supposed to represent). Last, while we're in startup/rcconf let's remove the unnecessary use of a GLOBAL (RCCONF_MENU_LIST) for the menu_list.
Diffstat (limited to 'usr.sbin/bsdconfig/networking')
-rwxr-xr-xusr.sbin/bsdconfig/networking/networking13
-rw-r--r--usr.sbin/bsdconfig/networking/share/resolv.subr11
2 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking
index e1d30cf..ba34af3 100755
--- a/usr.sbin/bsdconfig/networking/networking
+++ b/usr.sbin/bsdconfig/networking/networking
@@ -48,23 +48,22 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
#
dialog_menu_main()
{
- local menu_list
- local hline="$hline_arrows_tab_enter"
- local defaultitem= # Calculated below
-
- menu_list="
+ local prompt=
+ local menu_list="
'X' '$msg_exit'
'1' '$msg_hostname_domain'
'2' '$msg_network_interfaces'
'3' '$msg_default_router'
'4' '$msg_dns_nameservers'
" # END-QUOTE
+ local defaultitem= # Calculated below
+ local hline="$hline_arrows_tab_enter"
local height width rows
eval f_dialog_menu_size height width rows \
\"\$DIALOG_TITLE\" \
\"\$DIALOG_BACKTITLE\" \
- \"\" \
+ \"\$prompt\" \
\"\$hline\" \
$menu_list
@@ -79,7 +78,7 @@ dialog_menu_main()
--ok-label \"\$msg_ok\" \
--cancel-label \"\$msg_cancel\" \
--default-item \"\$defaultitem\" \
- --menu \"\" \
+ --menu \"\$prompt\" \
$height $width $rows \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
diff --git a/usr.sbin/bsdconfig/networking/share/resolv.subr b/usr.sbin/bsdconfig/networking/share/resolv.subr
index 59e0332..8e8ad78 100644
--- a/usr.sbin/bsdconfig/networking/share/resolv.subr
+++ b/usr.sbin/bsdconfig/networking/share/resolv.subr
@@ -392,23 +392,24 @@ f_dialog_input_nameserver()
#
f_dialog_menu_nameservers()
{
+ local prompt="$msg_dns_configuration"
+ local menu_list # Calculated below
+ local hline="$hline_arrows_tab_enter"
+ local defaultitem=
local height width rows
local opt_exit="$msg_return_to_previous_menu"
local opt_add="$msg_add_nameserver"
- local hline="$hline_arrows_tab_enter"
- local prompt defaultitem=
#
# Loop forever until the user has finished configuring nameservers
#
- prompt="$msg_dns_configuration"
while :; do
#
# Re/Build list of nameservers
#
local nameservers="$( f_resolv_conf_nameservers )"
- local menu_list="$(
+ menu_list=$(
index=1
echo "'X $msg_exit' '$opt_exit'"
@@ -423,7 +424,7 @@ f_dialog_menu_nameservers()
echo "'$tag nameserver' '$ns'"
index=$(( $index + 1 ))
done
- )"
+ )
#
# Display configuration-edit menu
OpenPOWER on IntegriCloud