Deleted Added
sdiff udiff text old ( 241899 ) new ( 242107 )
full compact
1if [ ! "$_COMMON_SUBR" ]; then _COMMON_SUBR=1
2#
3# Copyright (c) 2012 Ron McDowell
4# Copyright (c) 2012 Devin Teske
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions

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

20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26# SUCH DAMAGE.
27#
28# $FreeBSD: head/usr.sbin/bsdconfig/share/common.subr 242107 2012-10-26 00:31:25Z dteske $
29#
30############################################################ GLOBALS
31
32#
33# Program name
34#
35pgm="${0##*/}"
36

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

135 #
136 if f_have f_dialog_msgbox; then
137 f_dialog_msgbox "$msg"
138 else
139 dialog --msgbox "$msg" 0 0
140 fi
141}
142
143# f_show_help $file
144#
145# Display a language help-file. Automatically takes $LANG and $LC_ALL into
146# consideration when displaying $file (suffix ".$LC_ALL" or ".$LANG" will
147# automatically be added prior to loading the language help-file).
148#
149# If a language has been requested by setting either $LANG or $LC_ALL in the
150# environment and the language-specific help-file does not exist we will fall
151# back to $file without-suffix.
152#
153# If the language help-file does not exist, an error is displayed instead.
154#
155f_show_help()
156{
157 local file="$1"
158 local lang="${LANG:-$LC_ALL}"
159
160 [ -f "$file.$lang" ] && file="$file.$lang"
161
162 #
163 # Use f_dialog_textbox from dialog.subr if possible, otherwise fall
164 # back to dialog(1) (without options, making it obvious when using
165 # un-aided system dialog).
166 #
167 if f_have f_dialog_textbox; then
168 f_dialog_textbox "$file"
169 else
170 dialog --msgbox "$( cat "$file" 2>&1 )" 0 0
171 fi
172}
173
174# f_include $file
175#
176# Include a shell subroutine file.
177#
178# If the subroutine file exists but returns error status during loading, exit
179# is called and execution is prematurely terminated with the same error status.
180#
181f_include()

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

205 f_dprintf "lang=[$lang]"
206 if [ -f "$file.$lang" ]; then
207 . "$file.$lang" || exit $?
208 else
209 . "$file" || exit $?
210 fi
211}
212
213# f_usage $file [ $key1 $value1 ... ]
214#
215# Display USAGE file with optional pre-processor macro definitions. The first
216# argument is the template file containing the usage text to be displayed. If
217# $LANG or $LC_ALL (in order of preference, respectively) is set, ".encoding"
218# will automatically be appended as a suffix to the provided $file pathname.
219#
220# When processing $file, output begins at the first line containing that is

--- 110 unchanged lines hidden ---