#!/system/bin/sh
[ ! -z ${DEBUG} ] && set -x

CUR_NAME="${0##*/}"

# variable predefined for future use
# 
CMD_PARAMETER=""

if [ ${CUR_NAME} = openssh_bin_wrapper ] ; then
  echo "ERROR: Do not call this script - this is only a wrapper used to call the executables with a well defined enviroment"
  exit 254
fi


# settings for all binaries
# 
# export TERMINFO="/system/etc/terminfo"

export LD_LIBRARY_PATH="/system/lib64/openssh_libs:${LD_LIBRARY_PATH}"

CUR_BINARY="/system/usr/libexec/bin/${CUR_NAME}"
[ ! -x "${CUR_BINARY}" ] && CUR_BINARY="/system//usr/bin/${CUR_NAME}"

if [ ! -x "${CUR_BINARY}" ] ; then
  echo "Binary \"${CUR_NAME}\" not found"
  exit 127
fi

eval 'exec  ${CUR_BINARY} ${CMD_PARAMETER} ${1+"$@"}'

# eval 'exec  ${0%/*}/${0##*/}.bin ${CMD_PARAMETER} ${1+"$@"}'


