dialog.subr (790062d26b0c05491013eb1c82b536914d160b54) dialog.subr (b5bd0bacd6c7fb453431ffb73c595b4ecb9e8e40)
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:

--- 1756 unchanged lines hidden (view full) ---

1765 setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive
1766
1767 # Return the data on standard-out if desired
1768 [ "$__var_to_set" ] || echo "$__cp"
1769
1770 return $SUCCESS
1771}
1772
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:

--- 1756 unchanged lines hidden (view full) ---

1765 setvar DIALOG_MENU_$$ "" # scrub memory in case data was sensitive
1766
1767 # Return the data on standard-out if desired
1768 [ "$__var_to_set" ] || echo "$__cp"
1769
1770 return $SUCCESS
1771}
1772
1773# f_dialog_menuitem_store [-s] $text
1774#
1775# Store the item from a dialog(1) menu (see f_dialog_menutag2item()) to be
1776# retrieved later by f_dialog_menuitem_fetch(). If the first argument is `-s',
1777# the text is sanitized before being stored.
1778#
1779f_dialog_menuitem_store()
1780{
1781 local sanitize=
1782 [ "$1" = "-s" ] && sanitize=1 && shift 1 # -s
1783 local text="$1"
1784
1785 # Sanitize the menuitem before storing it if desired
1786 [ "$sanitize" ] && f_dialog_data_sanitize text
1787
1788 setvar DIALOG_MENUITEM_$$ "$text"
1789}
1790
1791# f_dialog_menuitem_fetch [$var_to_set]
1792#
1793# Obtain the menuitem chosen by the user from the most recently displayed
1794# dialog(1) menu (previously stored with f_dialog_menuitem_store() above). If
1795# $var_to_set is NULL or missing, output is printed to stdout (which is less
1796# recommended due to performance degradation; in a loop for example).
1797#
1798f_dialog_menuitem_fetch()
1799{
1800 local __var_to_set="$1" __cp
1801
1802 debug= f_getvar DIALOG_MENUITEM_$$ "${__var_to_set:-__cp}" # get data
1803 setvar DIALOG_MENUITEM_$$ "" # scrub memory in case data was sensitive
1804
1805 # Return the data on standard-out if desired
1806 [ "$__var_to_set" ] || echo "$__cp"
1807
1808 return $SUCCESS
1809}
1810
1773# f_dialog_default_store [-s] $text
1774#
1775# Store some text to be used later as the --default-item argument to dialog(1)
1776# (or Xdialog(1)) for --menu, --checklist, and --radiolist widgets. Retrieve
1777# the text later with f_dialog_menutag_fetch(). If the first argument is `-s',
1778# the text is sanitized before being stored.
1779#
1780f_dialog_default_store()

--- 326 unchanged lines hidden ---
1811# f_dialog_default_store [-s] $text
1812#
1813# Store some text to be used later as the --default-item argument to dialog(1)
1814# (or Xdialog(1)) for --menu, --checklist, and --radiolist widgets. Retrieve
1815# the text later with f_dialog_menutag_fetch(). If the first argument is `-s',
1816# the text is sanitized before being stored.
1817#
1818f_dialog_default_store()

--- 326 unchanged lines hidden ---