diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/chroot-tools/distcc-tool | 11 | ||||
-rwxr-xr-x | src/lib/librelib | 5 | ||||
-rw-r--r-- | src/lib/messages.sh | 11 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index d181109..ba0c9bc 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -37,20 +37,19 @@ fi q0="$(printf '%q' "$0")" # quoted $0 panic() { - echo "$(gettext 'panic: malformed call to internal function')" >&2 + gettext 'panic: malformed call to internal function' >&2 exit 1 } error() { - mesg="$(gettext "$1")"; shift - printf "$(gettext 'ERROR:') $mesg\n" "$@" >&2 + local mesg; mesg="$(gettext "$1")"; shift + printf -- "$(gettext 'ERROR:') $mesg\n" "$@" >&2 exit 1 } print() { - local mesg=$1 - shift - printf -- "$(gettext "$mesg")\n" "$@" + local mesg; mesg="$(gettext "$1")"; shift + printf -- "$mesg\n" "$@" } usage() { diff --git a/src/lib/librelib b/src/lib/librelib index fc03e32..5f17b6f 100755 --- a/src/lib/librelib +++ b/src/lib/librelib @@ -29,8 +29,7 @@ _l() { } print() { - local mesg="$(_ "$1")" - shift + local mesg; mesg="$(_ "$1")"; shift printf -- "$mesg\n" "$@" } @@ -41,7 +40,7 @@ whitespace_collapse() { } prose() { - local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift + local mesg; mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift printf -- "$mesg" "$@" | fmt -u } diff --git a/src/lib/messages.sh b/src/lib/messages.sh index e85590f..2dc53d6 100644 --- a/src/lib/messages.sh +++ b/src/lib/messages.sh @@ -43,7 +43,7 @@ # # For programming errors, bails immediately with little fanfare. panic() { - echo "$(_l _ 'panic: malformed call to internal function')" >&2 + _l _ 'panic: malformed call to internal function' >&2 exit 1 } @@ -52,8 +52,7 @@ panic() { # Like printf, but gettext-aware, and prints a trailing newline print() { [[ $# -ge 1 ]] || panic - local mesg="$(_ "$1")" - shift + local mesg; mesg="$(_ "$1")"; shift printf -- "$mesg\n" "$@" } @@ -78,7 +77,7 @@ whitespace_collapse() { # printing a paragraph of prose in --help text. prose() { [[ $# -ge 1 ]] || panic - local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift + local mesg; mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift printf -- "$mesg" "$@" | fmt -u } @@ -87,7 +86,7 @@ prose() { # remaining lines. bullet() { [[ $# -ge 1 ]] || panic - local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift + local mesg; mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift # Wrap the text to 71 columns; 75 (the default) minus a 4 column indent printf -- "$mesg" "$@" | fmt -u -w 71 | sed -e '1s/^/ - /' -e '2,$s/^/ /' } @@ -152,7 +151,7 @@ flag() { else [[ $# -gt 1 ]] || panic local flag=$1 - local desc="$(_ "$(whitespace_collapse <<<"$2")")" + local desc; desc="$(_ "$(whitespace_collapse <<<"$2")")" shift 2 local lines |