Lines Matching +full:turned +full:- +full:off

3 #	debug.sh - selectively debug scripts
7 # DebugOn [-eo] "tag" ...
8 # DebugOff [-eo] [rc="rc"] "tag" ...
22 # flexible run-time tracing of complicated shell scripts.
25 # It turns tracing off if "!tag" is found in "DEBUG_SH".
28 # If '-e' option given returns 1 if no "tag" matched.
29 # If the '-o' flag is given, tracing is turned off unless there
38 # off if any "tag" matches "DEBUG_ON". This allows nested
41 # DebugOff accepts but ignores the '-e' and '-o' options.
64 # calls DebugOff to turn it off.
68 # is turned on. "DEBUGGING" is the same as "DEBUG_SKIP" for
76 # If a function turns tracing on, ksh turns it off when the
77 # function returns - useless.
78 # PD ksh works ok ;-)
86 # @(#) Copyright (c) 1994-2024 Simon J. Gerraty
88 # SPDX-License-Identifier: BSD-2-Clause
90 # Please send copies of changes and bug-fixes to:
96 Myname=${Myname:-`basename $0 .sh`}
104 if test -z "$_HAVE_SH"; then
131 if test -z "$isPOSIX_SHELL"; then
170 *) set -x
203 DEBUG_X=-x
209 set -x
212 ,*|:,|:,*[${CASE_CLASS_NEG:-!}A-Za-z0-9_]*) ;;
216 set -x
224 # Actually turn off tracing, set $DEBUG_OFF=$match
230 # We do hooks_run after turning off tracing, but before resetting
237 ,*|:,|:,*[${CASE_CLASS_NEG:-!}A-Za-z0-9_]*) ;;
282 echo `date '+@ %s [%Y-%m-%d %H:%M:%S %Z]'` "$@"
288 # Something hard to miss when wading through huge -x output
296 set -x
300 # DebugOn [-e] [-o] match ...
305 eval ${local:-:} _e _match _off _rc
306 _rc=0 # avoid problems with set -e
311 -e) _rc=1; shift;; # caller ok with return 1
312 -o) _off=; shift;; # off unless we have a match
316 case ",${DEBUG_SH:-$DEBUG}," in
322 # if debugging is off because of a !e
328 for _e in ${*:-$Myname} $_e
330 : $_e in ,${DEBUG_SH:-$DEBUG},
331 case ",${DEBUG_SH:-$DEBUG}," in
333 # only turn it off if it was on
339 # only turn it on if it was off
347 if test -z "$_off$_match"; then
348 # off unless explicit match, but
349 # only turn it off if it was on
353 $DEBUG_DO set -x # back on if needed
354 $DEBUG_DO set -x # make sure we see it in trace
359 # DebugOff [-e] [-o] [rc=$?] match ...
361 # Only turn debugging off if one of our args was the reason it
362 # was turned on.
367 # The options '-e' and '-o' are ignored, they just make it easier to
371 eval ${local:-:} _e _rc
372 case ",${DEBUG_SH:-$DEBUG}," in
380 -[eo]) shift;; # ignore it
402 $DEBUG_DO set -x # back on if needed
403 $DEBUG_DO set -x # make sure we see it in trace
407 _TTY=${_TTY:-`test -t 0 && tty`}; export _TTY
416 ${DEBUG_SHELL:-${SHELL:-/bin/sh}} < $_TTY > $_TTY 2>&1
422 eval ${local:-:} _e
426 for _e in ${*:-$Myname} all
444 case "${DEBUG_SH:-$DEBUG}" in
446 *) DEBUG_ON=${DEBUG_ON:-_Debug}
447 DebugOn -e $* || DebugOff $DEBUG_LAST