Revision 9317
Added by Aaron Marcuse-Kubitza over 11 years ago
util.sh | ||
---|---|---|
376 | 376 |
{ local func="$1"; set_func_loc; echo "$(canon_rel_path "$file"):$line"; } |
377 | 377 |
|
378 | 378 |
# usage: func() { [minor=1] echo_func; ... } |
379 |
function echo_func() # usage: [minor=1] "echo_func" "$@" && indent || true |
|
379 |
function echo_func() |
|
380 |
# usage: [minor=1] "echo_func" "$FUNCNAME" "$@" && indent || true |
|
380 | 381 |
# exit status: whether function call was echoed |
381 | 382 |
{ |
382 | 383 |
kw_params minor |
384 |
local func="$1"; shift |
|
383 | 385 |
|
384 | 386 |
log++; if test "$minor"; then log++; fi |
385 |
echo_cmd "$(func_loc "${FUNCNAME[1]}")" "${FUNCNAME[1]}" "$@"
|
|
387 |
echo_cmd "$(func_loc "$func")" "$func" "$@"
|
|
386 | 388 |
can_log |
387 | 389 |
} |
388 |
alias echo_func='"echo_func" "$@" && indent || true' |
|
390 |
alias echo_func='"echo_func" "$FUNCNAME" "$@" && indent || true'
|
|
389 | 391 |
|
390 | 392 |
fi # load new aliases |
391 | 393 |
if self_being_included; then |
Also available in: Unified diff
lib/sh/util.sh: echo_func(): take the FUNCNAME as an argument (auto-added in the echo_func alias) instead of getting it from the FUNCNAME array (which would have produced an inaccurate value if another function call (such as log++) intervened between the caller and echo_func())