dialog.subr (251242) | dialog.subr (251244) |
---|---|
1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 2# 3# Copyright (c) 2006-2013 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-2013 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 251242 2013-06-02 05:45:25Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/dialog.subr 251244 2013-06-02 09:02:12Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." dialog.subr 34f_include $BSDCFG_SHARE/strings.subr 35f_include $BSDCFG_SHARE/variable.subr --- 1716 unchanged lines hidden (view full) --- 1752 setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive 1753 1754 # Return the data on standard-out if desired 1755 [ "$__var_to_set" ] || echo "$__cp" 1756 1757 return $SUCCESS 1758} 1759 | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." dialog.subr 34f_include $BSDCFG_SHARE/strings.subr 35f_include $BSDCFG_SHARE/variable.subr --- 1716 unchanged lines hidden (view full) --- 1752 setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive 1753 1754 # Return the data on standard-out if desired 1755 [ "$__var_to_set" ] || echo "$__cp" 1756 1757 return $SUCCESS 1758} 1759 |
1760# f_dialog_default_store [-s] $text 1761# 1762# Store some text to be used later as the --default-item argument to dialog(1) 1763# (or Xdialog(1)) for --menu, --checklist, and --radiolist widgets. Retrieve 1764# the text later with f_dialog_menutag_fetch(). If the first argument is `-s', 1765# the text is sanitized before being stored. 1766# 1767f_dialog_default_store() 1768{ 1769 local sanitize= 1770 [ "$1" = "-s" ] && sanitize=1 && shift 1 # -s 1771 local text="$1" 1772 1773 # Sanitize the defaulitem before storing it if desired 1774 [ "$sanitize" ] && f_dialog_data_sanitize text 1775 1776 setvar DEFAULTITEM_$$ "$text" 1777} 1778 1779# f_dialog_default_fetch [$var_to_set] 1780# 1781# Obtain text to be used with the --default-item argument of dialog(1) (or 1782# Xdialog(1)) (previously stored with f_dialog_default_store() above). If 1783# $var_to_set is NULL or missing, output is printed to stdout (which is less 1784# recommended due to performance degradation; in a loop for example). 1785# 1786f_dialog_default_fetch() 1787{ 1788 local __var_to_set="$1" __cp 1789 1790 debug= f_getvar DEFAULTITEM_$$ "${__var_to_set:-__cp}" # get the data 1791 setvar DEFAULTITEM_$$ "" # scrub memory in case data was sensitive 1792 1793 # Return the data on standard-out if desired 1794 [ "$__var_to_set" ] || echo "$__cp" 1795 1796 return $SUCCESS 1797} 1798 |
|
1760# f_dialog_menutag2item $tag_chosen $tag1 $item1 $tag2 $item2 ... 1761# 1762# To use the `--menu' option of dialog(1) you must pass an ordered list of 1763# tag/item pairs on the command-line. When the user selects a menu option the 1764# tag for that item is printed to stderr. 1765# 1766# This function allows you to dereference the tag chosen by the user back into 1767# the item associated with said tag. --- 286 unchanged lines hidden --- | 1799# f_dialog_menutag2item $tag_chosen $tag1 $item1 $tag2 $item2 ... 1800# 1801# To use the `--menu' option of dialog(1) you must pass an ordered list of 1802# tag/item pairs on the command-line. When the user selects a menu option the 1803# tag for that item is printed to stderr. 1804# 1805# This function allows you to dereference the tag chosen by the user back into 1806# the item associated with said tag. --- 286 unchanged lines hidden --- |