#!/bin/sh
dst=$1; shift
scanner=$1; shift
postfix=$1; shift

flags='-p'
[ `basename ${scanner}` = 'entry_point.pl' ] && flags='-fh'

. ./config-${HOSTNAME}.sh

type="ELF ${TEVWH_ELF_ADDR_SIZE}-bit ${TEVWH_BYTE_ORDER}SB executable"

# On Solaris 'find' has no -print0 and 'xargs' has neither -0 nor -r
${TEVWH_PATH_FIND} "$@" -type f -name "*${postfix}" \
| ${TEVWH_PATH_XARGS} ${TEVWH_PATH_FILE} \
| ${TEVWH_PATH_SED} -ne "s/:[[:space:]]*${type}.*//p" \
| ${TEVWH_PATH_TEE} ${dst}.files \
| ${TEVWH_PATH_XARGS} ${TEVWH_PATH_OBJDUMP} ${flags} \
| ${scanner} 2>&1 \
| ${TEVWH_PATH_SED} "s#^${TEVWH_TMP}/##" \
| ${TEVWH_PATH_TEE} ${dst}.full \
| ${TEVWH_PATH_TAIL} \
> ${dst} 
