dialog.subr (240783) | dialog.subr (242107) |
---|---|
1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 2# 3# Copyright (c) 2006-2012 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 2# 3# Copyright (c) 2006-2012 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/dialog.subr 240783 2012-09-21 19:03:25Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/dialog.subr 242107 2012-10-26 00:31:25Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_include $BSDCFG_SHARE/strings.subr 34 35BSDCFG_LIBE="/usr/libexec/bsdconfig" --- 974 unchanged lines hidden (view full) --- 1010 1011 eval $DIALOG \ 1012 --title \"\$DIALOG_TITLE\" \ 1013 --backtitle \"\$DIALOG_BACKTITLE\" \ 1014 --ok-label \"\$msg_ok\" \ 1015 --msgbox \"\$msg_text\" $size 1016} 1017 | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_include $BSDCFG_SHARE/strings.subr 34 35BSDCFG_LIBE="/usr/libexec/bsdconfig" --- 974 unchanged lines hidden (view full) --- 1010 1011 eval $DIALOG \ 1012 --title \"\$DIALOG_TITLE\" \ 1013 --backtitle \"\$DIALOG_BACKTITLE\" \ 1014 --ok-label \"\$msg_ok\" \ 1015 --msgbox \"\$msg_text\" $size 1016} 1017 |
1018############################################################ TEXTBOX FUNCTIONS 1019 1020# f_dialog_textbox $file 1021# 1022# Display the contents of $file (or an error if $file does not exist, etc.) in 1023# a dialog(1) textbox (which has a scrollable region for the text). The textbox 1024# remains until the user presses ENTER or ESC, acknowledging the modal dialog. 1025# 1026# If the user presses ENTER, the exit status is zero (success), otherwise if 1027# the user presses ESC the exit status is 255. 1028# 1029f_dialog_textbox() 1030{ 1031 [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init 1032 1033 local file="$1" 1034 local contents retval size 1035 1036 contents=$( cat "$file" 2>&1 ) 1037 retval=$? 1038 1039 size=$( f_dialog_buttonbox_size \ 1040 "$DIALOG_TITLE" \ 1041 "$DIALOG_BACKTITLE" \ 1042 "$contents" ) 1043 1044 if [ $retval -eq $SUCCESS ]; then 1045 eval $DIALOG \ 1046 --title \"\$DIALOG_TITLE\" \ 1047 --backtitle \"\$DIALOG_BACKTITLE\" \ 1048 --exit-label \"\$msg_ok\" \ 1049 --no-cancel \ 1050 --textbox \"\$file\" $size 1051 else 1052 eval $DIALOG \ 1053 --title \"\$DIALOG_TITLE\" \ 1054 --backtitle \"\$DIALOG_BACKTITLE\" \ 1055 --ok-label \"\$msg_ok\" \ 1056 --msgbox \"\$msg_text\" $size 1057 fi 1058} 1059 |
|
1018############################################################ YESNO FUNCTIONS 1019 1020# f_dialog_yesno $msg_text ... 1021# 1022# Display a dialog(1) Yes/No prompt to allow the user to make some decision. 1023# The yesno prompt remains until the user presses ENTER or ESC, acknowledging 1024# the modal dialog. 1025# --- 398 unchanged lines hidden --- | 1060############################################################ YESNO FUNCTIONS 1061 1062# f_dialog_yesno $msg_text ... 1063# 1064# Display a dialog(1) Yes/No prompt to allow the user to make some decision. 1065# The yesno prompt remains until the user presses ENTER or ESC, acknowledging 1066# the modal dialog. 1067# --- 398 unchanged lines hidden --- |