diff options
Diffstat (limited to 'src/chroot-tools/distcc-tool')
-rwxr-xr-x | src/chroot-tools/distcc-tool | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 3f7a30f..67bcd2d 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -28,35 +28,45 @@ # On Parabola, this means the packages: # bash, coreutils, sed, socat +if ! type gettext &>/dev/null; then + gettext() { echo "$@"; } +fi + panic() { - echo 'panic: malformed call to internal function' >&2 + echo "$(gettext 'panic: malformed call to internal function')" >&2 exit 1 } error() { - fmt=$1; shift - printf "ERROR: $fmt\n" "$@" >&2 + mesg="$(gettext "$1")"; shift + printf "$(gettext 'ERROR:') $mesg\n" "$@" >&2 exit 1 } +print() { + local mesg=$1 + shift + printf -- "$(gettext "$mesg")\n" "$@" +} + usage() { - echo "Usage: $0 COMMAND [COMMAND-ARGS]" - echo "Tool for using distcc within a networkless chroot" + print "Usage: $0 COMMAND [COMMAND-ARGS]" + print "Tool for using distcc within a networkless chroot" echo - echo "Commands:" - echo ' help print this message' - echo ' odaemon CHROOTPATH daemon to run outside of the chroot' - echo ' idaemon DISTCC_HOSTS daemon to run inside of the chroot' - echo ' rewrite DISTCC_HOSTS prints a rewritten version of DISTCC_HOSTS' - echo ' client HOST PORT connects stdio to TCP:$HOST:$PORT' - echo 'Commands: for internal use' - echo ' server counterpart to client; spawned by odaemon' + print "Commands:" + print ' help print this message' + print ' odaemon CHROOTPATH daemon to run outside of the chroot' + print ' idaemon DISTCC_HOSTS daemon to run inside of the chroot' + print ' rewrite DISTCC_HOSTS prints a rewritten version of DISTCC_HOSTS' + print ' client HOST PORT connects stdio to TCP:$HOST:$PORT' + print 'Commands: for internal use' + print ' server counterpart to client; spawned by odaemon' } errusage() { if [[ $# -gt 0 ]]; then - fmt=$1; shift - printf "ERROR: $fmt\n" "$@" >&2 + fmt="$(gettext "$1")"; shift + printf "$(gettext 'ERROR:') $fmt\n" "$@" >&2 fi usage >&2 exit 1 @@ -125,7 +135,7 @@ parse_DISTCC_HOSTS() { ;; # ZEROCONF +zeroconf) - error "$0 does not support the +zeroconf option" + error "%s does not support the +zeroconf option" "$0" exit 1 ;; # TCP_HOST or OLDSTYLE_TCP_HOST |