diff options
author | Bruno Haible <bruno@clisp.org> | 2005-12-19 12:37:56 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:12:58 +0200 |
commit | e59c7f764b93527051a68cf2f47266c3dad03e08 (patch) | |
tree | f4d059ff3c47945e9249d981a43b5b972b3592ad /gettext-runtime/src | |
parent | 8fdcb57f89df6966bb15954a534faea1b608ad17 (diff) | |
download | external_gettext-e59c7f764b93527051a68cf2f47266c3dad03e08.zip external_gettext-e59c7f764b93527051a68cf2f47266c3dad03e08.tar.gz external_gettext-e59c7f764b93527051a68cf2f47266c3dad03e08.tar.bz2 |
Workaround against zsh problem.
Diffstat (limited to 'gettext-runtime/src')
-rw-r--r-- | gettext-runtime/src/ChangeLog | 4 | ||||
-rw-r--r-- | gettext-runtime/src/gettext.sh.in | 71 |
2 files changed, 43 insertions, 32 deletions
diff --git a/gettext-runtime/src/ChangeLog b/gettext-runtime/src/ChangeLog index 720f2dc..cc35821 100644 --- a/gettext-runtime/src/ChangeLog +++ b/gettext-runtime/src/ChangeLog @@ -1,3 +1,7 @@ +2005-12-19 Bruno Haible <bruno@clisp.org> + + * gettext.sh.in: Make it work when sourced by zsh. + 2005-05-23 Bruno Haible <bruno@clisp.org> * gettext-0.14.5 released. diff --git a/gettext-runtime/src/gettext.sh.in b/gettext-runtime/src/gettext.sh.in index 75d3f69..1e1a2c7 100644 --- a/gettext-runtime/src/gettext.sh.in +++ b/gettext-runtime/src/gettext.sh.in @@ -39,40 +39,47 @@ fi # $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate # the Filesystem Hierarchy Standard when doing so, this script is executable. # Therefore it needs to support the standard --help and --version. -case "$0" in - gettext.sh | */gettext.sh | *\gettext.sh) - progname=$0 - package=@PACKAGE@ - version=@VERSION@ - # func_usage - # outputs to stdout the --help usage message. - func_usage () - { - echo "GNU gettext shell script function library version $version" - echo "Usage: . gettext.sh" - } - # func_version - # outputs to stdout the --version message. - func_version () - { - echo "$progname (GNU $package) $version" - echo "Copyright (C) 2003-2005 Free Software Foundation, Inc. +if test -z "$ZSH_VERSION"; then + # zsh is not POSIX compliant: By default, while ". gettext.sh" is executed, + # it sets $0 to "gettext.sh", defeating the purpose of this test. But + # fortunately we know that when running under zsh, this script is always + # being sourced, not executed, because hardly anyone is crazy enough to + # install zsh as /bin/sh. + case "$0" in + gettext.sh | */gettext.sh | *\gettext.sh) + progname=$0 + package=@PACKAGE@ + version=@VERSION@ + # func_usage + # outputs to stdout the --help usage message. + func_usage () + { + echo "GNU gettext shell script function library version $version" + echo "Usage: . gettext.sh" + } + # func_version + # outputs to stdout the --version message. + func_version () + { + echo "$progname (GNU $package) $version" + echo "Copyright (C) 2003-2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - echo "Written by" "Bruno Haible" - } - if test $# = 1; then - case "$1" in - --help | --hel | --he | --h ) - func_usage; exit 0 ;; - --version | --versio | --versi | --vers | --ver | --ve | --v ) - func_version; exit 0 ;; - esac - fi - func_usage 1>&2 - exit 1 - ;; -esac + echo "Written by" "Bruno Haible" + } + if test $# = 1; then + case "$1" in + --help | --hel | --he | --h ) + func_usage; exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version; exit 0 ;; + esac + fi + func_usage 1>&2 + exit 1 + ;; + esac +fi # eval_gettext MSGID # looks up the translation of MSGID and substitutes shell variables in the |