summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/networking/share/ipaddr.subr
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2012-12-21 18:58:19 +0000
committerdteske <dteske@FreeBSD.org>2012-12-21 18:58:19 +0000
commit5e7ea05b1afc71ededb3af74c2ab29cec62cc286 (patch)
treeb36ed1ce72c48c84674686128b0f6e806b3330e4 /usr.sbin/bsdconfig/networking/share/ipaddr.subr
parent804c67a4867afb8b7ef41a3ade748cab870b788c (diff)
downloadFreeBSD-src-5e7ea05b1afc71ededb3af74c2ab29cec62cc286.zip
FreeBSD-src-5e7ea05b1afc71ededb3af74c2ab29cec62cc286.tar.gz
Add much-needed dialog(1) --inputbox function for simplifying the process of
requesting input from the user.
Diffstat (limited to 'usr.sbin/bsdconfig/networking/share/ipaddr.subr')
-rw-r--r--usr.sbin/bsdconfig/networking/share/ipaddr.subr30
1 files changed, 5 insertions, 25 deletions
diff --git a/usr.sbin/bsdconfig/networking/share/ipaddr.subr b/usr.sbin/bsdconfig/networking/share/ipaddr.subr
index 65c2b98..b345d1c 100644
--- a/usr.sbin/bsdconfig/networking/share/ipaddr.subr
+++ b/usr.sbin/bsdconfig/networking/share/ipaddr.subr
@@ -360,41 +360,21 @@ f_dialog_input_ipaddr()
fi
local msg="$( printf "$msg_please_enter_new_ip_addr" "$interface" )"
- local hline="$hline_num_punc_tab_enter"
- local size="$( f_dialog_inputbox_size \
- "$DIALOG_TITLE" \
- "$DIALOG_BACKTITLE" \
- "$msg" \
- "$_ipaddr" \
- "$hline" )"
#
# Loop until the user provides taint-free input.
#
+ local retval
while :; do
- local dialog_inputbox
- dialog_inputbox=$( eval $DIALOG \
- --title \"\$DIALOG_TITLE\" \
- --backtitle \"\$DIALOG_BACKTITLE\" \
- --hline \"\$hline\" \
- --ok-label \"\$msg_ok\" \
- --cancel-label \"\$msg_cancel\" \
- --inputbox \"\$msg\" $size \
- \"\$_ipaddr\" \
- 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
- )
-
- local retval=$?
- setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox"
- _input=$( f_dialog_inputstr )
-
#
# Return error status if:
- # - User has not made any changes to the given value
# - User has either pressed ESC or chosen Cancel/No
+ # - User has not made any changes to the given value
#
+ _input=$( f_dialog_input "$msg" "$_ipaddr" \
+ "$hline_num_punc_tab_enter"
+ ) || return
[ "$_ipaddr" = "$_input" ] && return $FAILURE
- [ $retval -eq $SUCCESS ] || return $retval
# Return success if NULL value was entered
[ "$_input" ] || return $SUCCESS
OpenPOWER on IntegriCloud