]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Workaround against zsh problem.
authorBruno Haible <bruno@clisp.org>
Mon, 19 Dec 2005 12:37:56 +0000 (12:37 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:58 +0000 (12:12 +0200)
gettext-runtime/src/ChangeLog
gettext-runtime/src/gettext.sh.in

index 720f2dc872570b84c750840667581a365e38195e..cc35821449166510c9e403df090de282cc299cc8 100644 (file)
@@ -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.
index 75d3f69aa5098275efe0f5ad0cd08df6ace1840c..1e1a2c7288bc3d21852ee573fb7567e594ce6d23 100644 (file)
@@ -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