]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
trim down the length of the shell function test
authorPaolo Bonzini <bonzini@gnu.org>
Thu, 30 Oct 2008 09:23:40 +0000 (10:23 +0100)
committerPaolo Bonzini <bonzini@gnu.org>
Thu, 30 Oct 2008 09:23:40 +0000 (10:23 +0100)
* lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_WORK): Condense.

lib/m4sugar/m4sh.m4

index 141658764a96ff2b9d2ab7c3c35f56f9def7376c..e097e1e6dd5c3027824ae05101f08cda8a2e9050 100644 (file)
@@ -387,43 +387,19 @@ m4_define([_AS_RUN],
 # This is a spy to detect "in the wild" shells that do not support shell
 # functions correctly.  It is based on the m4sh.at Autotest testcases.
 m4_define([_AS_SHELL_FN_WORK],
-[as_func_return ()
-{
-  (exit [$]1)
-}
-as_func_success ()
-{
-  as_func_return 0
-}
-as_func_failure ()
-{
-  as_func_return 1
-}
-as_func_ret_success ()
-{
-  return 0
-}
-as_func_ret_failure ()
-{
-  return 1
-}
+[as_func_return () { (exit [$]1); }
+as_func_success () { as_func_return 0; }
+as_func_failure () { as_func_return 1; }
+as_func_ret_success () { return 0; }
+as_func_ret_failure () { return 1; }
 
 exitcode=0
-AS_IF([as_func_success], [],
-  [exitcode=1
-  echo as_func_success failed.])
-AS_IF([as_func_failure],
-  [exitcode=1
-  echo as_func_failure succeeded.])
-AS_IF([as_func_ret_success], [],
-  [exitcode=1
-  echo as_func_ret_success failed.])
-AS_IF([as_func_ret_failure],
-  [exitcode=1
-  echo as_func_ret_failure succeeded.])
+as_func_success || { exitcode=1; echo as_func_success failed.; }
+as_func_failure && { exitcode=1; echo as_func_failure succeeded.; }
+as_func_ret_success || { exitcode=1; echo as_func_ret_success failed.; }
+as_func_ret_failure && { exitcode=1; echo as_func_ret_failure succeeded.; }
 AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
-  [exitcode=1
-  echo positional parameters were not saved.])
+      [exitcode=1; echo positional parameters were not saved.])
 test x$exitcode = x0[]])# _AS_SHELL_FN_WORK