Changeset 30 for trunk/test/test.sh


Ignore:
Timestamp:
Apr 27, 2006, 10:40:32 PM (18 years ago)
Author:
rainer
Message:

Release candidate 3 for version 2.2.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test.sh

    r29 r30  
    1919# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2020#
     21
     22# -----------------------------------------------------------------------
     23# Be Bourne compatible
     24# -----------------------------------------------------------------------
     25
     26if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
     27  emulate sh
     28  NULLCMD=:
     29elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
     30  set -o posix
     31fi
     32
     33# -----------------------------------------------------------------------
     34# Make sure we support functions (from the autoconf manual)
     35# -----------------------------------------------------------------------
     36
     37TSHELL="${TSHELL-/bin/sh}"
     38if test x"$1" = "x--re-executed"
     39then
     40    shift
     41elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     42then
     43    :
     44else
     45    for cmd in sh bash ash bsh ksh zsh sh5; do
     46        X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
     47        OLD_IFS=${IFS}
     48        IFS=':'; export IFS
     49        for dir in $X; do
     50            shell="$dir/$cmd"
     51            if (test -f "$shell" || test -f "$shell.exe")
     52            then
     53                if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     54                then
     55                    TSHELL="$shell"; export TSHELL
     56                    IFS=${OLD_IFS}; export IFS
     57                    exec "$shell" "$0" --re-executed ${1+"$@"}
     58                fi
     59            fi
     60        done
     61        IFS=${OLD_IFS}; export IFS
     62    done
     63    echo "-----------------------------------------------------------------"
     64    echo "ERROR: Unable to locate a shell interpreter with function support" >&2
     65    echo "-----------------------------------------------------------------"
     66    { (exit 1); exit 1; }
     67fi
     68
     69# -----------------------------------------------------------------------
     70# Make sure we support 'let' (from the autoconf manual)
     71# -----------------------------------------------------------------------
     72
     73TSHELL="${TSHELL-/bin/sh}"
     74if test x"$1" = "x--re-run"
     75then
     76    shift
     77elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1
     78then
     79    :
     80else
     81    for cmd in sh bash ash bsh ksh zsh sh5; do
     82        X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
     83        OLD_IFS=${IFS}
     84        IFS=':'; export IFS
     85        for dir in $X; do
     86            shell="$dir/$cmd"
     87            if (test -f "$shell" || test -f "$shell.exe")
     88            then
     89                if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     90                then
     91                    if "$shell" -c  'a=5; let "a = a + 5"' >/dev/null 2>&1
     92                    then
     93                        TSHELL="$shell"; export TSHELL
     94                        IFS=${OLD_IFS}; export IFS
     95                        exec "$shell" "$0" --re-run ${1+"$@"}
     96                    fi
     97                fi
     98            fi
     99        done
     100        IFS=${OLD_IFS}; export IFS
     101    done
     102    echo "-----------------------------------------------------------------"
     103    echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2
     104    echo "-----------------------------------------------------------------"
     105    { (exit 1); exit 1; }
     106fi
     107
     108
     109umask 0022
    21110
    22111isok=`test -t 1 2>&1 | wc -c`
     
    366455        tmp="localhost"
    367456    fi
    368     echo "$tmp"
     457    #
     458    # first one is hostname, others are aliases
     459    #
     460    tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'`
     461    if [ -z "$tmp2" ]; then
     462        echo "$tmp"
     463    else
     464        echo "$tmp2"
     465    fi
    369466}
    370467
Note: See TracChangeset for help on using the changeset viewer.