bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext.sh can't be sourced from zsh using the default zsh options


From: Bruno Haible
Subject: Re: gettext.sh can't be sourced from zsh using the default zsh options
Date: Mon, 19 Dec 2005 13:35:42 +0100
User-agent: KMail/1.5

Sergio Talens-Oliag wrote:
> Using zsh with the option FUNCTION_ARGZERO set (the default), the
> gettext.sh script can't be sourced.
>
> I'm attaching a simple patch to fix it, see the explanation inside the
> patch. I've tested it against some bourne shells and all works as expected
> after the change.

Thanks. I'm applying the appended patch, which appears simpler and more
robust.

Bruno

*** gettext.sh.in       20 May 2005 21:06:00 -0000      1.2
--- gettext.sh.in       19 Dec 2005 12:37:05 -0000
***************
*** 39,44 ****
--- 39,50 ----
  # $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.
+ 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
***************
*** 73,78 ****
--- 79,85 ----
        exit 1
        ;;
    esac
+ fi
  
  # eval_gettext MSGID
  # looks up the translation of MSGID and substitutes shell variables in the





reply via email to

[Prev in Thread] Current Thread [Next in Thread]