diff options
author | dteske <dteske@FreeBSD.org> | 2012-12-21 18:58:19 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2012-12-21 18:58:19 +0000 |
commit | 5e7ea05b1afc71ededb3af74c2ab29cec62cc286 (patch) | |
tree | b36ed1ce72c48c84674686128b0f6e806b3330e4 /usr.sbin/bsdconfig/networking/share/hostname.subr | |
parent | 804c67a4867afb8b7ef41a3ade748cab870b788c (diff) | |
download | FreeBSD-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/hostname.subr')
-rw-r--r-- | usr.sbin/bsdconfig/networking/share/hostname.subr | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/usr.sbin/bsdconfig/networking/share/hostname.subr b/usr.sbin/bsdconfig/networking/share/hostname.subr index fed8679..e34e80c 100644 --- a/usr.sbin/bsdconfig/networking/share/hostname.subr +++ b/usr.sbin/bsdconfig/networking/share/hostname.subr @@ -132,41 +132,15 @@ f_dialog_input_hostname() msg="$msg_please_enter_fqhn" fi - local hline="$hline_alnum_punc_tab_enter" - # # Loop until the user provides taint-free input. # - local size height width while :; do - - size=$( f_dialog_inputbox_size \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$msg" \ - "$hostname" \ - "$hline" ) - 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 \ - \"\$hostname\" \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - hostname=$( f_dialog_inputstr ) - - [ $retval -eq $SUCCESS ] || return $retval - + hostname=$( f_dialog_input "$msg" "$hostname" \ + "$hline_alnum_punc_tab_enter" + ) || return # Taint-check the user's input f_dialog_validate_hostname "$hostname" && break - done # |