1if [ ! "$_COMMON_SUBR" ]; then _COMMON_SUBR=1
2#
3# Copyright (c) 2012 Ron McDowell
4# Copyright (c) 2012-2016 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 298884 2016-05-01 16:38:12Z pfg $
29#
30############################################################ CONFIGURATION
31
32#
33# Default file descriptors to link to stdout/stderr for passthru allowing
34# redirection within a sub-shell to bypass directly to the terminal.
35#
36: ${TERMINAL_STDOUT_PASSTHRU:=3}
--- 125 unchanged lines hidden (view full) ---
162 "$debug" "$debugFile"
163
164 #
165 # Automagically enable debugging if debugFile is set (and non-NULL)
166 #
167 [ "$debugFile" ] && { [ "${debug+set}" ] || debug=1; }
168
169 #
170 # Make debugging persistent if set
171 #
172 [ "$debug" ] && export debug
173 [ "$debugFile" ] && export debugFile
174
175 #
176 # Truncate debug file unless requested otherwise. Note that we will
177 # trim a leading plus (`+') from the value of debugFile to support
178 # persistent meaning that f_dprintf() should print both to standard
179 # output and $debugFile (minus the leading plus, of course).
180 #
181 local _debug_file="${debugFile#+}"
182 if [ "$_debug_file" -a "$DEBUG_INITIALIZE_FILE" ]; then
183 if ( umask 022 && :> "$_debug_file" ); then
184 f_dprintf "Successfully initialized debugFile \`%s'" \
185 "$_debug_file"
186 f_isset debug || debug=1 # turn debugging on if not set
--- 860 unchanged lines hidden ---
2#
3# Copyright (c) 2012 Ron McDowell
4# Copyright (c) 2012-2016 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 298884 2016-05-01 16:38:12Z pfg $
29#
30############################################################ CONFIGURATION
31
32#
33# Default file descriptors to link to stdout/stderr for passthru allowing
34# redirection within a sub-shell to bypass directly to the terminal.
35#
36: ${TERMINAL_STDOUT_PASSTHRU:=3}
--- 125 unchanged lines hidden (view full) ---
162 "$debug" "$debugFile"
163
164 #
165 # Automagically enable debugging if debugFile is set (and non-NULL)
166 #
167 [ "$debugFile" ] && { [ "${debug+set}" ] || debug=1; }
168
169 #
170 # Make debugging persistent if set
171 #
172 [ "$debug" ] && export debug
173 [ "$debugFile" ] && export debugFile
174
175 #
176 # Truncate debug file unless requested otherwise. Note that we will
177 # trim a leading plus (`+') from the value of debugFile to support
178 # persistent meaning that f_dprintf() should print both to standard
179 # output and $debugFile (minus the leading plus, of course).
180 #
181 local _debug_file="${debugFile#+}"
182 if [ "$_debug_file" -a "$DEBUG_INITIALIZE_FILE" ]; then
183 if ( umask 022 && :> "$_debug_file" ); then
184 f_dprintf "Successfully initialized debugFile \`%s'" \
185 "$_debug_file"
186 f_isset debug || debug=1 # turn debugging on if not set
--- 860 unchanged lines hidden ---