#!/bin/sh
##
##  flexelint.sh -- FlexeLint run-time wrapper
##

#   paths
flexelint_binary="@l_prefix@/libexec/flexelint/flexelint"
flexelint_cfgdir="@l_prefix@/etc/flexelint"
flexelint_incdir="@l_prefix@/share/flexelint/lnt"

#   determine default configuration
#   (hint: extension .lnt is specially recognized by FlexeLint)
flexelint_config=""
if [ ".$1" = ".-C" ]; then
    shift
elif [ -f ${HOME}/.flexelint.lnt ]; then
    flexelint_config="${HOME}/.flexelint.lnt"
else
    flexelint_config="${flexelint_cfgdir}/flexelint.lnt"
fi

#   execute program
if [ $# -eq 0 ]; then
    eval ${flexelint_binary}
else
    eval ${flexelint_binary}  \
        -I${flexelint_incdir} \
        ${flexelint_config}   \
        ${1+"$@"}
fi

