diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2024-10-22 18:07:37 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2024-10-22 18:07:37 +0000 |
| commit | 02653835cd6f1dc4a34f08d3b744fbb7c4b1ecdb (patch) | |
| tree | fd4c8e1e3d2b52705a1fd79eb98db90965bb4129 /libexec | |
| parent | f6197f2bc05b5a8df260cbf55283fddf7c76fec4 (diff) | |
Diffstat (limited to 'libexec')
| -rwxr-xr-x | libexec/rc/debug.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libexec/rc/debug.sh b/libexec/rc/debug.sh index eea8a011bc09..b098f0b359b5 100755 --- a/libexec/rc/debug.sh +++ b/libexec/rc/debug.sh @@ -9,6 +9,7 @@ # DebugOn [-eo] "tag" ... # DebugOff [-eo] [rc="rc"] "tag" ... # Debugging +# DebugAdd "tag" # DebugEcho ... # DebugLog ... # DebugShell "tag" ... @@ -39,6 +40,9 @@ # default of 0. Thus if DebugOff is the last operation in a # function, "rc" will be the return code of that function. # +# DebugAdd allows adding a "tag" to "DEBUG_SH" to influence +# later events, possibly in a child process. +# # DebugEcho is just shorthand for: #.nf # $DEBUG_DO echo "$@" @@ -74,7 +78,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: debug.sh,v 1.40 2024/09/09 20:06:00 sjg Exp $ +# $Id: debug.sh,v 1.41 2024/10/22 17:57:22 sjg Exp $ # # @(#) Copyright (c) 1994-2024 Simon J. Gerraty # @@ -167,6 +171,21 @@ _debugOff() { DEBUG_X= } +## +# DebugAdd tag +# +# Add tag to DEBUG_SH +# +DebugAdd() { + DEBUG_SH=${DEBUG_SH:+$DEBUG_SH,}$1 + export DEBUG_SH +} + +## +# DebugEcho message +# +# Output message if we are debugging +# DebugEcho() { $DEBUG_DO echo "$@" } |
